code: def gamma_trace(t):
      """
      trace of a single line of gamma matrices
  
      Examples
      ========
  
      >>> from sympy.physics.hep.gamma_matrices import GammaMatrix as G, \
          gamma_trace, LorentzIndex
      >>> from sympy.tensor.tensor import tensor_indices, tensor_heads
      >>> p, q = tensor_heads('p, q', [LorentzIndex])
      >>> i0,i1,i2,i3,i4,i5 = tensor_indices('i0:6', LorentzIndex)
      >>> ps = p(i0)*G(-i0)
      >>> qs = q(i0)*G(-i0)
      >>> gamma_trace(G(i0)*G(i1))
      4*metric(i0, i1)
      >>> gamma_trace(ps*ps) - 4*p(i0)*p(-i0)
      0
      >>> gamma_trace(ps*qs + ps*ps) - 4*p(i0)*p(-i0) - 4*p(i0)*q(-i0)
      0
  
      """
      if isinstance(t, TensAdd):
          res = TensAdd(*[gamma_trace(x) for x in t.args])
          return res
      t = _simplify_single_line(t)
      res = _trace_single_line(t)
      return res
  
file_path: sympy/sympy/physics/hep/gamma_matrices.py
imports: from sympy.core.mul import Mul
  from sympy.core.singleton import S
  from sympy.matrices.dense import eye
  from sympy.matrices.expressions.trace import trace
  from sympy.tensor.tensor import TensorIndexType, TensorIndex, TensMul, TensAdd, tensor_mul, Tensor, TensorHead, TensorSymmetry
label_desc: Use image node_id 4 for calling a global function with example usage: gamma_trace(t) and returns: res, res