def escape_latex(string):
    """
    Get string, where reserved LaTeX charachters are escaped.

    For more info regarding LaTeX reserved charachters read this:
    https://en.wikibooks.org/wiki/LaTeX/Basics#Reserved_Characters
    """
    string = string.replace("\\", "\\\\")
    string = string.replace("&", r"\&")
    string = string.replace("%", r"\%")
    string = string.replace("$", r"\$")
    string = string.replace("#", r"\#")
    string = string.replace("_", r"\_")
    string = string.replace("{", r"\{")
    string = string.replace("}", r"\}")
    string = string.replace("~", r"\textasciitilde ")
    string = string.replace("^", r"\textasciicircum ")
    return string