'Find all prefixes that has been mapped to a namespace URI.
The local mapping is searched, then it walks up the tree until
it reaches the top collecting all matches.
@param uri: A namespace URI.
@type uri: basestring
@param match: A matching function L{Element.matcher}.
@type match: basestring
@return: A list of mapped prefixes.
@rtype: [basestring,...]'

def findPrefixes(self, uri, match='eq'):

    result = []
    for item in self.nsprefixes.items():
        if self.matcher[match](item[1], uri):
            prefix = item[0]
            result.append(prefix)
    for item in self.specialprefixes.items():
        if self.matcher[match](item[1], uri):
            prefix = item[0]
            result.append(prefix)
    if (self.parent is not None):
        result += self.parent.findPrefixes(uri, match)
    return result
