code: def _is_scalar(e):
      """Helper method used in Tr"""
  
      # sympify to set proper attributes
      e = sympify(e)
      if isinstance(e, Expr):
          if (
              e.is_Integer
              or e.is_Float
              or e.is_Rational
              or e.is_Number
              or (e.is_Symbol and e.is_commutative)
          ):
              return True
  
      return False
  
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 1 for calling a global function with example usage: _is_scalar(e) and returns: False, True