def revert(self, a):
        """
        Compute a**(-1), if possible.
        """
        I = self.ring.ideal(a.data) + self.base_ideal
        try:
            return self(I.in_terms_of_generators(1)[0])
        except __HOLE__:  # 1 not in I
            raise NotReversible('%s not a unit in %r' % (a, self))
dataset/ETHPy150Open sympy/sympy/sympy/polys/domains/quotientring.py/QuotientRing.revert