'Returns the leading term a*x**b as a tuple (a, b).
Examples
>>> from sympy.abc import x
>>> (1+x+x**2).leadterm(x)
(1, 0)
>>> (1/x**2+x+x**2).leadterm(x)
(1, -2)'

def leadterm(self, x):

    from sympy import Dummy, log
    l = self.as_leading_term(x)
    d = Dummy('logx')
    if l.has(log(x)):
        l = l.subs(log(x), d)
    (c, e) = l.as_coeff_exponent(x)
    if (x in c.free_symbols):
        from sympy.utilities.misc import filldedent
        raise ValueError(filldedent(('\n                                                                cannot    compute    leadterm(%s,    %s).    The    coefficient\n                                                                should    have    been    free    of    x    but    got    %s' % (self, x, c))))
    c = c.subs(d, log(x))
    return (c, e)
