def precedence_traditional(item):
 from sympy import Integral, Sum, Product, Limit, Derivative
 from sympy.core.expr import UnevaluatedExpr
 if isinstance(item, (Integral, Sum, Product, Limit, Derivative)):
  return PRECEDENCE['Mul']
 elif isinstance(item, UnevaluatedExpr):
  return precedence_traditional(item.args[0])
 else:
  return precedence(item)

def precedence_traditional ( item ) : from sympy import Integral , Sum , Product , Limit , Derivative from sympy . core . expr import UnevaluatedExpr if isinstance ( item , ( Integral , Sum , Product , Limit , Derivative ) ) : return PRECEDENCE [ 'Mul' ] elif isinstance ( item , UnevaluatedExpr ) : return precedence_traditional ( item . args [ 0 ] ) else : return precedence ( item )
returns the precedence of a given object according to the traditional rules of mathematics .