code: def memoize(func):
      """Based off functools.lru_cache (not available in Python 2).
  
      A little inefficient but we're just storing floats.
      """
      sentinal = object()
      unhashable = object()
      cache = {}
  
      @wraps(func)
      def wrapper(*args, **kwargs):
          key = _make_key(args, kwargs, unhashable)
          if key is unhashable:
              return func(*args, **kwargs)
          result = cache.get(key, sentinal)
          if result is not sentinal:
              return result
          result = func(*args, **kwargs)
          cache[key] = result
          return result
  
      return wrapper
  
file_path: AIF360/aif360/metrics/metric.py
imports: from abc import abstractmethod
  from collections.abc import Hashable
  from functools import wraps
  from aif360.datasets import Dataset
  from aif360.decorating_metaclass import ApplyDecorator
label_desc: Use image node_id 2 for calling a global function with example usage: memoize(func) and returns: wrapper, result, func, result