code: def flatten(expr, new=new):
      """Flatten T(a, b, T(c, d), T2(e)) to T(a, b, c, d, T2(e))"""
      cls = expr.__class__
      args = []
      for arg in expr.args:
          if arg.__class__ == cls:
              args.extend(arg.args)
          else:
              args.append(arg)
      return new(expr.__class__, *args)
  
file_path: sympy/sympy/strategies/rl.py
imports: from sympy.utilities.iterables import sift
  from .util import new
label_desc: Use image node_id 7 for calling a global function with example usage: flatten(expr, new) and returns: new