def html_escape(s): return re_html_escaping.sub(lambda x: html_escaping.get(x.group(0)), s)
def escape_if_needed(s): if use_html: return re_html_escaping.sub(lambda x: html_escaping.get(x.group(0)), s) else: return s