# Path: pyxmpp2/etree.py
# class ElementClass:
#     def __subclasshook__(cls, other):
# def element_to_unicode(element):
# 
# Path: pyxmpp2/exceptions.py
# class StreamParseError(FatalStreamError):
#     """Raised when invalid XML is received in an XMPP stream."""
#     pass


import threading
import logging
from .etree import ElementTree
from .exceptions import StreamParseError
        - `lock`: :std:`threading.RLock`
        - `in_use`: `bool`
        - `_started`: `bool`
    """
    # pylint: disable-msg=R0903
    def __init__(self, handler):
        """Initialize the reader.

        :Parameters:
            - `handler`: Object to handle stream start, end and stanzas.
        :Types:
            - `handler`: `XMLStreamHandler`
        """
        self.handler = handler
        self.parser = ElementTree.XMLParser(target = ParserTarget(handler))
        self.lock = threading.RLock()
        self.in_use = False
        self._started = False

    def feed(self, data):
        """Feed the parser with a chunk of data. Apropriate methods
        of `handler` will be called whenever something interesting is
        found.

        :Parameters:
            - `data`: the chunk of data to parse.
        :Types:
            - `data`: `str`"""
        with self.lock:
            if self.in_use:

# Path: pyxmpp2/etree.py
# class ElementClass:
#     def __subclasshook__(cls, other):
# def element_to_unicode(element):
# 
# Path: pyxmpp2/exceptions.py
# class StreamParseError(FatalStreamError):
#     """Raised when invalid XML is received in an XMPP stream."""
#     pass


# Path: pyxmpp2/xmppparser.py
import threading
import logging
from .etree import ElementTree
from .exceptions import StreamParseError

        - `lock`: :std:`threading.RLock`
        - `in_use`: `bool`
        - `_started`: `bool`
    """
    # pylint: disable-msg=R0903
    def __init__(self, handler):
        """Initialize the reader.

        :Parameters:
            - `handler`: Object to handle stream start, end and stanzas.
        :Types:
            - `handler`: `XMLStreamHandler`
        """
        self.handler = handler
        self.parser = ElementTree.XMLParser(target = ParserTarget(handler))
        self.lock = threading.RLock()
        self.in_use = False
        self._started = False

    def feed(self, data):
        """Feed the parser with a chunk of data. Apropriate methods
        of `handler` will be called whenever something interesting is
        found.

        :Parameters:
            - `data`: the chunk of data to parse.
        :Types:
            - `data`: `str`"""
        with self.lock:
            if self.in_use:

                raise StreamParseError("StreamReader.feed() is not reentrant!")