code: def watch(value, spectator_type=Spectator):
      
      if isinstance(value, Watchable):
          wtype = type(value)
      else:
          raise TypeError("Expected a Watchable, not %r." % value)
      spectator = getattr(value, "_instance_spectator", None)
      if not isinstance(spectator, Spectator):
          spectator = spectator_type(wtype)
          value._instance_spectator = spectator
      return spectator
docs: Register a :class:`Specatator` to a :class:`Watchable` and return it.
  
      In order to register callbacks to an eventful object, you need to create
      a Spectator that will watch it for you. A :class:`Specatator` is a relatively simple
      object that has methods for adding, deleting, and triggering callbacks. To
      create a spectator we call ``spectator = watch(x)``, where x is a Watchable
      instance.
  
      Parameters
      ----------
      value : Watchable
          A :class:`Watchable` instance.
      spectator_type : Spectator
          The type of spectator that will be returned.
  
      Returns
      -------
      spectator: spectator_type
          The :class:`Specatator` (specified by ``spectator_type``) that is
          was registered to the given instance.