'Computes polynomial exact quotient of ``f`` by ``g``.
Examples
>>> from sympy import Poly
>>> from sympy.abc import x
>>> Poly(x**2 - 1, x).exquo(Poly(x - 1, x))
Poly(x + 1, x, domain=\'ZZ\')
>>> Poly(x**2 + 1, x).exquo(Poly(2*x - 4, x))
Traceback (most recent call last):
ExactQuotientFailed: 2*x - 4 does not divide x**2 + 1'

def exquo(f, g, auto=True):

    (dom, per, F, G) = f._unify(g)
    retract = False
    if (auto and dom.is_Ring and (not dom.is_Field)):
        (F, G) = (F.to_field(), G.to_field())
        retract = True
    if hasattr(f.rep, 'exquo'):
        try:
            q = F.exquo(G)
        except ExactQuotientFailed as exc:
            raise exc.new(f.as_expr(), g.as_expr())
    else:
        raise OperationNotSupported(f, 'exquo')
    if retract:
        try:
            q = q.to_ring()
        except CoercionFailed:
            pass
    return per(q)
