code: def set_toplevel_object(self, instance, class_=None):
          
          if class_ is None:
              class_ = type(instance)
          self._toplevels[class_] = instance
docs: Set the toplevel object to return from :meth:`get_toplevel_object` when
          asked for `class_` to `instance`.
  
          If `class_` is :data:`None`, the :func:`type` of the `instance` is
          used.