def METHOD_NAME(expr):
    """Flatten T(a, b, T(c, d), T2(e)) to T(a, b, c, d, T2(e))."""
    cls = operator(expr)
    args = []
    for arg in arguments(expr):
        if operator(arg) == cls:
            args.extend(arguments(arg))
        else:
            args.append(arg)
    return term(cls, args)