def __init__(self, node, write, **kw):
        '''Create and run the implementation.'''

        self.write = write
        self.subset = kw.get('subset')
        if self.subset:
            self.comments = kw.get('comments', 1)
        else:
            self.comments = kw.get('comments', 0)
        self.unsuppressedPrefixes = kw.get('unsuppressedPrefixes')
        nsdict = kw.get('nsdict', { 'xml': XMLNS.XML, 'xmlns': XMLNS.BASE })

        # Processing state.
        self.state = (nsdict, ['xml'], [])

        if node.nodeType == Node.DOCUMENT_NODE:
            self._do_document(node)
        elif node.nodeType == Node.ELEMENT_NODE:
            self.documentOrder = _Element        # At document element
            if self.unsuppressedPrefixes is not None:
                self._do_element(node)
            else:
                inherited = self._inherit_context(node)
                self._do_element(node, inherited)
        elif node.nodeType == Node.DOCUMENT_TYPE_NODE:
            pass
        else:
            raise TypeError, str(node)
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/api/SOAPpy/wstools/c14n.py/_implementation.__init__/original