docs: def cached(f):
      """Decorator for functions evaluated only once."""
      def memoized(*args, **kwargs):
          if hasattr(memoized, '__cache__'):
              return memoized.__cache__
          result = f(*args, **kwargs)
          memoized.__cache__ = result
          return result
      return memoized