# Path: pyxmpp2/constants.py
# STANZA_NAMESPACES = (STANZA_CLIENT_NS, STANZA_SERVER_NS)
# 
# STREAM_NS = "http://etherx.jabber.org/streams"
# 
# XML_NS = "http://www.w3.org/XML/1998/namespace"


import threading
import re
from xml.sax.saxutils import escape, quoteattr
from .constants import STANZA_NAMESPACES, STREAM_NS, XML_NS
        for namespace, prefix in self._root_prefixes.items():
            if prefix == "xml":
                continue
            if prefix:
                tag += u' xmlns:{0}={1}'.format(prefix, quoteattr(namespace))
            else:
                tag += u' xmlns={1}'.format(prefix, quoteattr(namespace))
        tag += u">"
        self._head_emitted = True
        return tag

    def emit_tail(self):
        """Return the end tag of the stream root element."""
        return u"</{0}:stream>".format(self._root_prefixes[STREAM_NS])

    def _split_qname(self, name, is_element):
        """Split an element of attribute qname into namespace and local
        name.

        :Parameters:
            - `name`: element or attribute QName
            - `is_element`: `True` for an element, `False` for an attribute
        :Types:
            - `name`: `unicode`
            - `is_element`: `bool`

        :Return: namespace URI, local name
        :returntype: `unicode`, `unicode`"""
        if name.startswith(u"{"):
            namespace, name = name[1:].split(u"}", 1)

# Path: pyxmpp2/constants.py
# STANZA_NAMESPACES = (STANZA_CLIENT_NS, STANZA_SERVER_NS)
# 
# STREAM_NS = "http://etherx.jabber.org/streams"
# 
# XML_NS = "http://www.w3.org/XML/1998/namespace"


# Path: pyxmpp2/xmppserializer.py
import threading
import re
from xml.sax.saxutils import escape, quoteattr
from .constants import STANZA_NAMESPACES, STREAM_NS, XML_NS

        for namespace, prefix in self._root_prefixes.items():
            if prefix == "xml":
                continue
            if prefix:
                tag += u' xmlns:{0}={1}'.format(prefix, quoteattr(namespace))
            else:
                tag += u' xmlns={1}'.format(prefix, quoteattr(namespace))
        tag += u">"
        self._head_emitted = True
        return tag

    def emit_tail(self):
        """Return the end tag of the stream root element."""
        return u"</{0}:stream>".format(self._root_prefixes[STREAM_NS])

    def _split_qname(self, name, is_element):
        """Split an element of attribute qname into namespace and local
        name.

        :Parameters:
            - `name`: element or attribute QName
            - `is_element`: `True` for an element, `False` for an attribute
        :Types:
            - `name`: `unicode`
            - `is_element`: `bool`

        :Return: namespace URI, local name
        :returntype: `unicode`, `unicode`"""
        if name.startswith(u"{"):
            namespace, name = name[1:].split(u"}", 1)

            if namespace in STANZA_NAMESPACES: