code: def lru_cache(maxsize=128, typed=False):
      """Least-recently-used cache decorator.
  
      If *maxsize* is set to None, the LRU features are disabled and the cache
      can grow without bound.
  
      If *typed* is True, arguments of different types will be cached separately.
      For example, f(decimal.Decimal("3.0")) and f(3.0) will be treated as
      distinct calls with distinct results. Some types such as str and int may
      be cached separately even when typed is false.
  
      Arguments to the cached function must be hashable.
  
      View the cache statistics named tuple (hits, misses, maxsize, currsize)
      with f.cache_info().  Clear the cache and statistics with f.cache_clear().
      Access the underlying function with f.__wrapped__.
  
      See:  https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)
  
      """
  
      # Users should only access the lru_cache through its public API:
      #       cache_info, cache_clear, and f.__wrapped__
      # The internals of the lru_cache are encapsulated for thread safety and
      # to allow the implementation to change (including a possible C version).
  
      if isinstance(maxsize, int):
          # Negative maxsize is treated as 0
          if maxsize < 0:
              maxsize = 0
      elif callable(maxsize) and isinstance(typed, bool):
          # The user_function was passed in directly via the maxsize argument
          user_function, maxsize = maxsize, 128
          wrapper = _lru_cache_wrapper(
              user_function, maxsize, typed, _CacheInfo
          )
          wrapper.cache_parameters = lambda: {
              "maxsize": maxsize,
              "typed": typed,
          }
          return update_wrapper(wrapper, user_function)
      elif maxsize is not None:
          raise TypeError(
              "Expected first argument to be an integer, a callable, or None"
          )
  
      def decorating_function(user_function):
          wrapper = _lru_cache_wrapper(
              user_function, maxsize, typed, _CacheInfo
          )
          wrapper.cache_parameters = lambda: {
              "maxsize": maxsize,
              "typed": typed,
          }
          return update_wrapper(wrapper, user_function)
  
      return decorating_function
  
imports: from abc import get_cache_token
  from collections import namedtuple
  from reprlib import recursive_repr
  from _thread import RLock
label_desc: Use image node_id 20 for calling a global function with example usage: lru_cache(maxsize, typed) and returns: decorating_function, update_wrapper, update_wrapper