def _is_scalar(e):
 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

def _is_scalar ( e ) : 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
helper method used in tr .