code: def cached_method(f):
      cache_name = "__%s_cache" % f.__name__
  
      def wrapper(self, *args):
          cache = getattr(self, cache_name, None)
          if cache is None:
              cache = {}
              setattr(self, cache_name, cache)
          if args in cache:
              return cache[args]
          res = cache[args] = f(self, *args)
          return res
  
      return wrapper
  
imports: from __future__ import absolute_import
  import os
  import sys
  import re
  import io
  import codecs
  import shutil
  import tempfile
  from contextlib import contextmanager
label_desc: Use image node_id 3 for calling a global function with example usage: cached_method(f) and returns: wrapper, res, cache