@classmethod
def _substitute_html_entity(cls, matchobj):
    """Used with a regular expression to substitute the
        appropriate HTML entity for a special character."""
    entity = cls.CHARACTER_TO_HTML_ENTITY.get(matchobj.group(0))
    return '&%s;' % entity
