def _getPrefix(self, node, nsuri):
try:<EOL><INDENT>if node and (node.nodeType == node.ELEMENT_NODE) and(nsuri == self._dom.findDefaultNS(node)):<EOL><INDENT>return None<EOL><DEDENT><DEDENT>except DOMException as ex:<EOL><INDENT>pass<EOL><DEDENT>if nsuri == XMLNS.XML:<EOL><INDENT>return self._xml_prefix<EOL><DEDENT>if node.nodeType == Node.ELEMENT_NODE:<EOL><INDENT>for attr in list(node.attributes.values()):<EOL><INDENT>if attr.namespaceURI == XMLNS.BASEand nsuri == attr.value:<EOL><INDENT>return attr.localName<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if node.parentNode:<EOL><INDENT>return self._getPrefix(node.parentNode, nsuri)<EOL><DEDENT><DEDENT><DEDENT>raise NamespaceError('<STR_LIT>' %nsuri)<EOL>
Keyword arguments:
    node -- DOM Element Node
    nsuri -- namespace of attribute value