def _get_coeff_exp(expr, x):
 from sympy import powsimp
 (c, m) = expand_power_base(powsimp(expr)).as_coeff_mul(x)
 if (not m):
  return (c, S(0))
 [m] = m
 if m.is_Pow:
  if (m.base != x):
   raise _CoeffExpValueError('expr not of form a*x**b')
  return (c, m.exp)
 elif (m == x):
  return (c, S(1))
 else:
  raise _CoeffExpValueError(('expr not of form a*x**b: %s' % expr))

def _get_coeff_exp ( expr , x ) : from sympy import powsimp ( c , m ) = expand_power_base ( powsimp ( expr ) ) . as_coeff_mul ( x ) if ( not m ) : return ( c , S ( 0 ) ) [ m ] = m if m . is_Pow : if ( m . base != x ) : raise _CoeffExpValueError ( 'expr not of form a*x**b' ) return ( c , m . exp ) elif ( m == x ) : return ( c , S ( 1 ) ) else : raise _CoeffExpValueError ( ( 'expr not of form a*x**b: %s' % expr ) )
when expr is known to be of the form c*x**b .