code: def reset(self):
          
          self._require_connection(accept_partial=True)
          self._reset_state()
          self._writer.start()
          self._smachine.rewind(State.STREAM_HEADER_SENT)
docs: Reset the stream by discarding all state and re-sending the stream
          header.
  
          Calling :meth:`reset` when the stream is disconnected or currently
          disconnecting results in either :class:`ConnectionError` being raised
          or the exception which caused the stream to die (possibly a received
          stream error or a transport error) to be reraised.
  
          :meth:`reset` puts the stream into :attr:`~State.STREAM_HEADER_SENT`
          state and it cannot be used for sending XSOs until the peer stream
          header has been received. Usually, this is not a problem as stream
          resets only occur during stream negotiation and stream negotiation
          typically waits for the peers feature node to arrive first.