docs: def assign(self, subject):
          """ Assigns the given subject to the topic """
          if not isinstance(subject, (Publisher, Subscriber)):
              raise TypeError('Assignee has to be Publisher or Subscriber')
  
          # check if not already assigned
          if self._subject is not None:
              raise SubscriptionError('Topic %r already assigned' % self._path)
  
          self._subject = subject
  
          # subscribe to subject if topic has subscriptions
          if self._subscriptions:
              self._subject.subscribe(self)
  
          # if topic received emits before assignment replay those emits
          if self._pre_assign_emit is not None:
              for value in self._pre_assign_emit:
                  self._subject.emit(value, who=self)
              self._pre_assign_emit = None
  
          return subject