def _split_mul(f, x):
 from sympy import polarify, unpolarify
 fac = S(1)
 po = S(1)
 g = S(1)
 f = expand_power_base(f)
 args = Mul.make_args(f)
 for a in args:
  if (a == x):
   po *= x
  elif (x not in a.free_symbols):
   fac *= a
  else:
   if (a.is_Pow and (x not in a.exp.free_symbols)):
    (c, t) = a.base.as_coeff_mul(x)
    if (t != (x,)):
     (c, t) = expand_mul(a.base).as_coeff_mul(x)
    if (t == (x,)):
     po *= (x ** a.exp)
     fac *= unpolarify(polarify((c ** a.exp), subs=False))
     continue
   g *= a
 return (fac, po, g)

def _split_mul ( f , x ) : from sympy import polarify , unpolarify fac = S ( 1 ) po = S ( 1 ) g = S ( 1 ) f = expand_power_base ( f ) args = Mul . make_args ( f ) for a in args : if ( a == x ) : po *= x elif ( x not in a . free_symbols ) : fac *= a else : if ( a . is_Pow and ( x not in a . exp . free_symbols ) ) : ( c , t ) = a . base . as_coeff_mul ( x ) if ( t != ( x , ) ) : ( c , t ) = expand_mul ( a . base ) . as_coeff_mul ( x ) if ( t == ( x , ) ) : po *= ( x ** a . exp ) fac *= unpolarify ( polarify ( ( c ** a . exp ) , subs = False ) ) continue g *= a return ( fac , po , g )
split expression f into fac .