def __cacheit(maxsize):
        def func_wrapper(func):
            cfunc = lru_cache(maxsize, typed=True)(func)

            # wraps here does not propagate all the necessary info
            # for py2.7, use update_wrapper below
            def wrapper(*args, **kwargs):
                try:
                    retval = cfunc(*args, **kwargs)
                except TypeError:
                    retval = func(*args, **kwargs)
                return retval

            wrapper.cache_info = cfunc.cache_info
            wrapper.cache_clear = cfunc.cache_clear

            # Some versions of update_wrapper erroneously assign the final
            # function of the wrapper chain to __wrapped__, see
            # https://bugs.python.org/issue17482 .
            # To work around this, we need to call update_wrapper first, then
            # assign to wrapper.__wrapped__.
            update_wrapper(wrapper, func)
            wrapper.__wrapped__ = cfunc.__wrapped__

            CACHE.append(wrapper)
            return wrapper

        return func_wrapper
caching decorator.
dataset/ETHPy150Open sympy/sympy/sympy/core/cache.py/__cacheit