code: def cached(prop):
      """
      Decorator for property getters to cache the property value.
      """
      cache = "_cached_" + prop.__name__
  
      def getter(self):
          val = getattr(self, cache, None)
          if val is None:
              val = prop(self)
              setattr(self, cache, val)
          return val
  
      getter.__doc__ = prop.__doc__
  
      return property(getter)
  
file_path: lkpy/lenskit/util/__init__.py
imports: import logging
  from textwrap import dedent
  from copy import deepcopy
  from ..algorithms import Algorithm
  from .log import log_to_notebook, log_to_stderr
  from .timing import Stopwatch
  from .random import derivable_rng
  from .parallel import proc_count
label_desc: Use image node_id 3 for calling a global function with example usage: cached(prop) and returns: property, val