code: def findPrefix(self, uri, default=None):
          
          for item in self.nsprefixes.items():
              if item[1] == uri:
                  prefix = item[0]
                  return prefix
          for item in self.specialprefixes.items():
              if item[1] == uri:
                  prefix = item[0]
                  return prefix
          if self.parent is not None:
              return self.parent.findPrefix(uri, default)
          else:
              return default
docs: Find the first prefix that has been mapped to a namespace URI.
          The local mapping is searched, then it walks up the tree until
          it reaches the top or finds a match.
          @param uri: A namespace URI.
          @type uri: basestring
          @param default: A default prefix when not found.
          @type default: basestring
          @return: A mapped prefix.
          @rtype: basestring