def _symbolic_factor(expr, opt, method):
 if (isinstance(expr, Expr) and (not expr.is_Relational)):
  if hasattr(expr, '_eval_factor'):
   return expr._eval_factor()
  (coeff, factors) = _symbolic_factor_list(together(expr), opt, method)
  return _keep_coeff(coeff, _factors_product(factors))
 elif hasattr(expr, 'args'):
  return expr.func(*[_symbolic_factor(arg, opt, method) for arg in expr.args])
 elif hasattr(expr, '__iter__'):
  return expr.__class__([_symbolic_factor(arg, opt, method) for arg in expr])
 else:
  return expr

def _symbolic_factor ( expr , opt , method ) : if ( isinstance ( expr , Expr ) and ( not expr . is_Relational ) ) : if hasattr ( expr , '_eval_factor' ) : return expr . _eval_factor ( ) ( coeff , factors ) = _symbolic_factor_list ( together ( expr ) , opt , method ) return _keep_coeff ( coeff , _factors_product ( factors ) ) elif hasattr ( expr , 'args' ) : return expr . func ( * [ _symbolic_factor ( arg , opt , method ) for arg in expr . args ] ) elif hasattr ( expr , '__iter__' ) : return expr . __class__ ( [ _symbolic_factor ( arg , opt , method ) for arg in expr ] ) else : return expr
helper function for :func:_factor .