def dominant(expr, n):
 terms = Add.make_args(expr.expand(func=True))
 term0 = terms[(-1)]
 comp = [term0]
 for t in terms[:(-1)]:
  e = (term0 / t).combsimp()
  l = limit_seq(e, n)
  if (l is S.Zero):
   term0 = t
   comp = [term0]
  elif (l is None):
   return None
  elif (l not in [S.Infinity, (- S.Infinity)]):
   comp.append(t)
 if (len(comp) > 1):
  return None
 return term0

def dominant ( expr , n ) : terms = Add . make_args ( expr . expand ( func = True ) ) term0 = terms [ ( - 1 ) ] comp = [ term0 ] for t in terms [ : ( - 1 ) ] : e = ( term0 / t ) . combsimp ( ) l = limit_seq ( e , n ) if ( l is S . Zero ) : term0 = t comp = [ term0 ] elif ( l is None ) : return None elif ( l not in [ S . Infinity , ( - S . Infinity ) ] ) : comp . append ( t ) if ( len ( comp ) > 1 ) : return None return term0
finds the most dominating term in an expression .