'Send stream header.'

def sendHeader(self):

    localPrefixes = {}
    for (uri, prefix) in iteritems(self.prefixes):
        if (uri != NS_STREAMS):
            localPrefixes[prefix] = uri
    rootElement = domish.Element((NS_STREAMS, 'stream'), self.namespace, localPrefixes=localPrefixes)
    if self.otherEntity:
        rootElement['to'] = self.otherEntity.userhost()
    if self.thisEntity:
        rootElement['from'] = self.thisEntity.userhost()
    if ((not self.initiating) and self.sid):
        rootElement['id'] = self.sid
    if (self.version >= (1, 0)):
        rootElement['version'] = ('%d.%d' % self.version)
    self.send(rootElement.toXml(prefixes=self.prefixes, closeElement=0))
    self._headerSent = True
