code: def __cacheit_debug(maxsize):
      """cacheit + code to check cache consistency"""
  
      def func_wrapper(func):
          cfunc = __cacheit(maxsize)(func)
  
          @wraps(func)
          def wrapper(*args, **kw_args):
              # always call function itself and compare it with cached version
              r1 = func(*args, **kw_args)
              r2 = cfunc(*args, **kw_args)
  
              # try to see if the result is immutable
              #
              # this works because:
              #
              # hash([1,2,3])         -> raise TypeError
              # hash({'a':1, 'b':2})  -> raise TypeError
              # hash((1,[2,3]))       -> raise TypeError
              #
              # hash((1,2,3))         -> just computes the hash
              hash(r1), hash(r2)
  
              # also see if returned values are the same
              if r1 != r2:
                  raise RuntimeError("Returned values are not the same")
              return r1
  
          return wrapper
  
      return func_wrapper
  
file_path: sympy/sympy/core/cache.py
imports: from importlib import import_module
  from typing import Callable
  from functools import lru_cache, wraps
label_desc: Use image node_id 3 for calling a global function with example usage: __cacheit_debug(maxsize) and returns: func_wrapper, wrapper, r1