def _convertEntities(self, match):
x = match.group(<NUM_LIT:1>)<EOL>if self.convertHTMLEntities and x in name2codepoint:<EOL><INDENT>return chr(name2codepoint[x])<EOL><DEDENT>elif x in self.XML_ENTITIES_TO_SPECIAL_CHARS:<EOL><INDENT>if self.convertXMLEntities:<EOL><INDENT>return self.XML_ENTITIES_TO_SPECIAL_CHARS[x]<EOL><DEDENT>else:<EOL><INDENT>return '<STR_LIT>' % x<EOL><DEDENT><DEDENT>elif len(x) > <NUM_LIT:0> and x[<NUM_LIT:0>] == '<STR_LIT:#>':<EOL><INDENT>if len(x) > <NUM_LIT:1> and x[<NUM_LIT:1>] == '<STR_LIT:x>':<EOL><INDENT>return chr(int(x[<NUM_LIT:2>:], <NUM_LIT:16>))<EOL><DEDENT>else:<EOL><INDENT>return chr(int(x[<NUM_LIT:1>:]))<EOL><DEDENT><DEDENT>elif self.escapeUnrecognizedEntities:<EOL><INDENT>return '<STR_LIT>' % x<EOL><DEDENT>else:<EOL><INDENT>return '<STR_LIT>' % x<EOL><DEDENT>
Used in a call to re.sub to replace HTML, XML, and numeric
        entities with the appropriate Unicode characters. If HTML
        entities are being converted, any unrecognized entities are
        escaped.