code: def GetElementNSdict(self, elt):
          '''Get a dictionary of all the namespace attributes for the indicated
          element.  The dictionaries are cached, and we recurse up the tree
          as necessary.
          '''
          d = self.ns_cache.get(id(elt))
          if not d:
              if elt != self.dom: d = self.GetElementNSdict(elt.parentNode)
              for a in _attrs(elt):
                  if a.namespaceURI == XMLNS.BASE:
                      if a.localName == "xmlns":
                          d[''] = a.nodeValue
                      else:
                          d[a.localName] = a.nodeValue
              self.ns_cache[id(elt)] = d
          return d.copy(f GetElementNSdict(self, elt):
          '''Get a dictionary of all the namespace attributes for the indicated
          element.  The dictionaries are cached, and we recurse up the tree
          as necessary.
          '''
          d = self.ns_cache.get(id(elt))
          if not d:
              if elt != self.dom: d = self.GetElementNSdict(elt.parentNode)
              for a in _attrs(elt):
                  if a.namespaceURI == XMLNS.BASE:
                      if a.localName == "xmlns":
                          d[''] = a.nodeValue
                      else:
                          d[a.localName] = a.nodeValue
              self.ns_cache[id(elt)] = d
          return d.copy()
docs: Get a dictionary of all the namespace attributes for the indicated
          element.  The dictionaries are cached, and we recurse up the tree
          as necessary.