def proxy_rewriter(condition, rewrite):
 def _proxy_rewriter(criteria):
  (criteria, integral) = criteria
  (integrand, symbol) = integral
  args = (criteria + list(integral))
  if condition(*args):
   rewritten = rewrite(*args)
   if (rewritten != integrand):
    return RewriteRule(rewritten, integral_steps(rewritten, symbol), integrand, symbol)
 return _proxy_rewriter

def proxy_rewriter ( condition , rewrite ) : def _proxy_rewriter ( criteria ) : ( criteria , integral ) = criteria ( integrand , symbol ) = integral args = ( criteria + list ( integral ) ) if condition ( * args ) : rewritten = rewrite ( * args ) if ( rewritten != integrand ) : return RewriteRule ( rewritten , integral_steps ( rewritten , symbol ) , integrand , symbol ) return _proxy_rewriter
strategy that rewrites an integrand based on some other criteria .