'Convert SymPy\'s Rational to `dtype`.'

def from_sympy(self, a):

    if a.is_Rational:
        return PythonRational(a.p, a.q)
    elif a.is_Float:
        from sympy.polys.domains import RR
        (p, q) = RR.to_rational(a)
        return PythonRational(int(p), int(q))
    else:
        raise CoercionFailed(('expected    `Rational`    object,    got    %s' % a))
