'Subtract two polynomials ``f`` and ``g``.
Examples
>>> from sympy import Poly
>>> from sympy.abc import x
>>> Poly(x**2 + 1, x).sub(Poly(x - 2, x))
Poly(x**2 - x + 3, x, domain=\'ZZ\')
>>> Poly(x**2 + 1, x) - Poly(x - 2, x)
Poly(x**2 - x + 3, x, domain=\'ZZ\')'

def sub(f, g):

    g = sympify(g)
    if (not g.is_Poly):
        return f.sub_ground(g)
    (_, per, F, G) = f._unify(g)
    if hasattr(f.rep, 'sub'):
        result = F.sub(G)
    else:
        raise OperationNotSupported(f, 'sub')
    return per(result)
