code: def cached_property(func):
      
      def get(self):
          """this docstring will be over-written by func.__doc__"""
          try:
              return self._property_cache[func]
          except AttributeError:
              self._property_cache = dict()
              prop = self._property_cache[func] = func(self)
              return prop
          except KeyError:
              prop = self._property_cache[func] = func(self)
              return prop
      get.__doc__ = func.__doc__
      return property(get)
docs: Return a cached property calculated by the input function.
  
      Unlike the ``property`` decorator builtin, this decorator will cache the
      return value in order to avoid repeated calculations.
      This is particularly useful when the property involves some non-trivial
      computation.
  
      For example, consider a class that models a right triangle.
      The hypotenuse ``c`` will only be calculated once.
  
      .. code-block:: python
  
         import math
  
         class RightTriangle:
             def __init__(self, a, b):
                 self.a = a
                 self.b = b
  
             @cached_property
             def c(self):
                 return math.sqrt(self.a**2 + self.b**2)