'Make the ground domain a field.
Examples
>>> from sympy import Poly, ZZ
>>> from sympy.abc import x
>>> Poly(x**2 + 1, x, domain=ZZ).to_field()
Poly(x**2 + 1, x, domain=\'QQ\')'

def to_field(f):

    if hasattr(f.rep, 'to_field'):
        result = f.rep.to_field()
    else:
        raise OperationNotSupported(f, 'to_field')
    return f.per(result)
