<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sanitize_tex(original_text):
 """Sanitize TeX text. :param original_text: the text to sanitize for LaTeX. :type original_text: str :returns: the sanitize text. Text is sanitized by following these steps: 1. Replaces ``\\` by ``\\textbackslash`` 2. Escapes certain characters (such as ``$``, ``%``, ``_``, ``}``, ``{``, ``&`` and ``#``) by adding a backslash (*e.g.* from ``&`` to ``\\&``). 3. Replaces special characters such as ``~`` by the LaTeX equivalent (*e.g.* from ``~`` to ``$\\sim$``). """

    # The backslashes
    sanitized_tex = original_text.replace("\\", r"\textbackslash ")

    # Escaping
    sanitized_tex = re.sub(r"([{}])".format("".join(_escaped_char)),
                           r"\\\g<1>", sanitized_tex)

    # Replacing
    for character, mod in _char_mod.items():
        sanitized_tex = sanitized_tex.replace(character, mod)

    return sanitized_tex