code: def underscore_memoization(func):
      """
      Decorator for methods::
  
          class A(object):
              def x(self):
                  if self._x:
                      self._x = 10
                  return self._x
  
      Becomes::
  
          class A(object):
              @underscore_memoization
              def x(self):
                  return 10
  
      A now has an attribute ``_x`` written by this decorator.
      """
      name = "_" + func.__name__
  
      def wrapper(self):
          try:
              return getattr(self, name)
          except AttributeError:
              result = func(self)
              setattr(self, name, result)
              return result
  
      return wrapper
  
file_path: catboost/contrib/python/jedi/py3/jedi/cache.py
imports: import time
  from functools import wraps
  from jedi import settings
  from parso.cache import parser_cache
label_desc: Use image node_id 1 for calling a global function with example usage: underscore_memoization(func) and returns: wrapper, getattr, result