code: def load(obj, cls, default_factory):
      
      if obj is None:
          return default_factory()
      if isinstance(obj, dict):
          return cls.load(obj)
      return obj
docs: Create or load an object if necessary.
  
      Parameters
      ----------
      obj : `object` or `dict` or `None`
      cls : `type`
      default_factory : `function`
  
      Returns
      -------
      `object`