code: def cachedproperty(func):
      
      key = '_' + func.__name__
      @wraps(func)
      def get(self):
          try:
              return getattr(self, key)
          except AttributeError:
              val = func(self)
              setattr(self, key, val)
              return val
      return property(get)
docs: A memoize decorator for class properties.