def dup_invert(f, g, K):
    s, h = dup_half_gcdex(f, g, K)

    if h == [K.one]:
        return dup_rem(s, g, K)
    else:
        raise NotInvertible("zero divisor")
Compute multiplicative inverse of `f` modulo `g` in `F[x]`.
dataset/ETHPy150Open sympy/sympy/sympy/polys/euclidtools.py/dup_invert