code: def _a2m_trace(arg):
      if isinstance(arg, _CodegenArrayAbstract):
          return _array_contraction(arg, (0, 1))
      else:
          from sympy.matrices.expressions.trace import Trace
  
          return Trace(arg)
  
imports: import itertools
  from collections import defaultdict
  from typing import Tuple, Union, FrozenSet, Dict, List, Optional
  from functools import singledispatch
  from itertools import accumulate
  from sympy import MatMul, Basic, Wild, KroneckerProduct
  from sympy.assumptions.ask import Q, ask
  from sympy.core.mul import Mul
  from sympy.core.singleton import S
  from sympy.matrices.expressions.diagonal import DiagMatrix
  from sympy.matrices.expressions.hadamard import hadamard_product, HadamardPower
  from sympy.matrices.expressions.matexpr import MatrixExpr
  from sympy.matrices.expressions.special import Identity, ZeroMatrix, OneMatrix
  from sympy.matrices.expressions.trace import Trace
  from sympy.matrices.expressions.transpose import Transpose
  from sympy.combinatorics.permutations import _af_invert, Permutation
  from sympy.matrices.matrixbase import MatrixBase
  from sympy.matrices.expressions.applyfunc import ElementwiseApplyFunction
  from sympy.matrices.expressions.matexpr import MatrixElement
  from sympy.tensor.array.expressions.array_expressions import PermuteDims, ArrayDiagonal, ArrayTensorProduct, OneArray, get_rank, _get_subrank, ZeroArray, ArrayContraction, ArrayAdd, _CodegenArrayAbstract, get_shape, ArrayElementwiseApplyFunc, _ArrayExpr, _EditArrayContraction, _ArgE, ArrayElement, _array_tensor_product, _array_contraction, _array_diagonal, _array_add, _permute_dims
  from sympy.tensor.array.expressions.utils import _get_mapping_from_subranks
label_desc: Use image node_id 29 for calling a global function with example usage: _a2m_trace(arg) and returns: _array_contraction, Trace