code: def _memoize(func, *args, **kw):
      # should we refresh the cache?
      refresh = False
      refresh_kw = func.mrefresh_keyword
  
      # kw is not always set - check args
      if refresh_kw in func.__code__.co_varnames:
          if args[func.__code__.co_varnames.index(refresh_kw)]:
              refresh = True
  
      # check in kw if not already set above
      if not refresh and refresh_kw in kw:
          if kw[refresh_kw]:
              refresh = True
  
      key = pickle.dumps(args, 1) + pickle.dumps(kw, 1)
  
      cache = func.mcache
      if not refresh and key in cache:
          return cache[key]
      else:
          cache[key] = result = func(*args, **kw)
          return result
  
file_path: ffn/ffn/utils.py
imports: import re
  import decorator
  import numpy
  import pandas
label_desc: Use image node_id 1 for calling a global function with example usage: _memoize(func) and returns: cache, result