code: def start(self):
          
          attrs = {
              (None, "to"): str(self._to),
              (None, "version"): ".".join(map(str, self._version))
          }
          if self._from:
              attrs[None, "from"] = str(self._from)
  
          self._writer.startDocument()
          for prefix, uri in self._nsmap_to_use.items():
              self._writer.startPrefixMapping(prefix, uri)
          self._writer.startElementNS(
              (namespaces.xmlstream, "stream"),
              None,
              attrs)
          self._writer.flush()
docs: Send the stream header as described above.