code: def findTargetNS(self, node):
          
          attrget = self.getAttr
          attrkey = (self.NS_XMLNS, 'xmlns')
          DOCUMENT_NODE = node.DOCUMENT_NODE
          ELEMENT_NODE = node.ELEMENT_NODE
          while 1:
              if node.nodeType != ELEMENT_NODE:
                  node = node.parentNode
                  continue
              result = attrget(node, 'targetNamespace', default=None)
              if result is not None:
                  return result
              node = node.parentNode
              if node.nodeType == DOCUMENT_NODE:
                  raise DOMException('Cannot determine target namespace.')
docs: Return the defined target namespace uri for the given node.