code: def ensure_object(self, object_type):
          
          rv = self.find_object(object_type)
          if rv is None:
              self.obj = rv = object_type()
          return rv
docs: Like :meth:`find_object` but sets the innermost object to a
          new instance of `object_type` if it does not exist.