code: def set_target(self, target: EventDispatcherBase) -> None:
          
          if self._target is not None:
              raise PermissionError("The target property already has a valid value.")
  
          if not isinstance(target, EventDispatcherBase):
              raise TypeError("Invalid target type: {}".format(target))
  
          self._target = target
docs: This method should be called by the event dispatcher that dispatches this event
          to set its target property.
  
          Args:
              target (EventDispatcherBase): The event dispatcher that will dispatch this event.
  
          Raises:
              PermissionError: If the target property of the event has already been set.
              TypeError: If `target` is not an `EventDispatcherBase` instance.