def escape(string, escape_pattern):
    """Assistant function for string escaping"""
    try:
        return string.translate(escape_pattern)
    except AttributeError:
        warnings.warn("Non-string-like data passed. "
                      "Attempting to convert to 'str'.")
        return str(string).translate(tag_escape)
def escape ( string , escape_pattern ) : try : return string . translate ( escape_pattern ) except AttributeError : warnings . warn ( "Non-string-like data passed. " "Attempting to convert to 'str'." ) return str ( string ) . translate ( tag_escape )
Assistant function for string escaping