code: def _rearrange_args(l):
      """this just moves the last arg to first position
      to enable expansion of args
      A,B,A ==> A**2,B
      """
      if len(l) == 1:
          return l
  
      x = list(l[-1:])
      x.extend(l[0:-1])
      return Mul(*x).args
  
file_path: sympy/sympy/physics/quantum/trace.py
imports: from sympy.core.add import Add
  from sympy.core.containers import Tuple
  from sympy.core.expr import Expr
  from sympy.core.mul import Mul
  from sympy.core.power import Pow
  from sympy.core.sorting import default_sort_key
  from sympy.core.sympify import sympify
  from sympy.matrices import Matrix
label_desc: Use image node_id 3 for calling a global function with example usage: _rearrange_args(l) and returns: Mul, l