@@ -0,0 +1,923 @@
+import re, htmlentitydefs%0A%0A# NOTE: Courtesy of Frederik Lundh.%0A#%0A# http://effbot.org/zone/re-sub.htm#unescape-html%0A%0A##%0A# Removes HTML or XML character references and entities from a text string.%0A#%0A# @param text The HTML (or XML) source text.%0A# @return The plain text, as a Unicode string, if necessary.%0A%0Adef unescape(text):%0A    def fixup(m):%0A        text = m.group(0)%0A        if text%5B:2%5D == %22&#%22:%0A            # character reference%0A            try:%0A                if text%5B:3%5D == %22&#x%22:%0A                    return unichr(int(text%5B3:-1%5D, 16))%0A                else:%0A                    return unichr(int(text%5B2:-1%5D))%0A            except ValueError:%0A                pass%0A        else:%0A            # named entity%0A            try:%0A                text = unichr(htmlentitydefs.name2codepoint%5Btext%5B1:-1%5D%5D)%0A            except KeyError:%0A                pass%0A        return text # leave as is%0A    return re.sub(%22&#?%5Cw+;%22, fixup, text)%0A

Add unescape_entities.py, code from Frederik Lundh, http://effbot.org/zone/re-sub.htm#unescape-html