code: def memoize(func):
      
      cache = {}
  
      @functools.wraps(func)
      def wrapper(*args):
          key = "__".join(str(arg) for arg in args)
          if key not in cache:
              cache[key] = func(*args)
          return cache[key]
      return wrapper
docs: Classic memoize decorator for non-class methods