(func)
return func_wrapper
After the function finishes, resets the value of mpmath.mp.dps to
    the value it had before the function was run.
After the function finishes, resets the value of mpmath.mp.dps to
    the value it had before the function was run.
After the function finishes resets the value of mpmath . mp . dps to the value it had before the function was run .
def conserve_mpmath_dps(func):
    """After the function finishes, resets the value of mpmath.mp.dps to
    the value it had before the function was run."""
    import functools
    from sympy import mpmath

    def func_wrapper():
        dps = mpmath.mp.dps
        try:
            func()
        finally:
            mpmath.mp.dps = dps

    func_wrapper = functools.update_wrapper(func_wrapper, func)
    return func_wrapper
def conserve_mpmath_dps ( func ) : import functools from sympy import mpmath def func_wrapper ( ) : dps = mpmath . mp . dps try : func ( ) finally : mpmath . mp . dps = dps func_wrapper = functools . update_wrapper ( func_wrapper , func ) return func_wrapper