def escape(string, escape_pattern):
try:<EOL><INDENT>return string.translate(escape_pattern)<EOL><DEDENT>except AttributeError:<EOL><INDENT>warnings.warn("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>return str(string).translate(tag_escape)<EOL><DEDENT>
Assistant function for string escaping