docs: def just_in_time_method(func):
    """
    This is a dcorator for methods. It redirect calls to the decorated method
    to the equivalent method in a class member called 'item'. 'item' is expected
    to be None when the class is instantiated. The point is to easily allow
    on-demand construction or loading of large, expensive objects just-in-time.
  
    To apply this decorator to a method in a class, the class must have the
    following instance variables:
  
    +--------------------------------------------------------------------------+
    | Name    |  Description                                                   |
    +=========+================================================================+
    | item    | The wrapped object. Calls to this method will be redirected    |
    |         | to the method with the same name in item. This should be set   |
    |         | to None when the object is created; it will be loaded          |
    |         | on-demand the first time this method is called.                |
    +---------+----------------------------------------------------------------+
    | factory | An object from which 'item' can be loaded. Can be a factory,   |
    |         | or similar, but must provide the subscript operator, as this   |
    |         | is used to pass a key that uniquely identifies 'item'          |
    +---------+----------------------------------------------------------------+
    | key     | any object that uniquely identifies 'item'; must be what is    |
    |         | expected by 'index' as argument for the subscript operator.    |
    +--------------------------------------------------------------------------+
  
    A common pattern is to create a new class B which inherits from A, implement
    the above requirements in B and then apply this decorator to all the methods
    inherited from A. If 'item' is an object of type A, then this pattern makes
    B behave exactly like A, but with just-in-time construction.
    """
  
    if not inspect.ismethod:
      raise MetaError("oops")
  
    def wrapper(self, *args, **kwargs):
      if self.item is None:
        self.item = self.factory[self.key]
      return getattr(self.item, func.__name__)(*args, **kwargs)
    return wrapper