@cacheit
    def _inverse_cdf_expression(self):
        x, z = symbols('x, z', real=True, positive=True, cls=Dummy)
        # Invert CDF
        try:
            inverse_cdf = list(solveset(self.cdf(x) - z, x))
        except NotImplementedError:
            inverse_cdf = None
        if not inverse_cdf or len(inverse_cdf) != 1:
            raise NotImplementedError("Could not invert CDF")

        return Lambda(z, inverse_cdf[0])
Inverse of the CDF
dataset/ETHPy150Open sympy/sympy/sympy/stats/drv.py/SingleDiscreteDistribution._inverse_cdf_expression