def escape_ldap_input(string):
    """
    This function escapes the user input such that all values are seen as text, not filter instructions.

    TL;DR: prevents LDAP injection

    :param string string: The to be escaped string
    :return string: The escaped string
    """
    escape_vals = {
        '\\': r'\5c',
        r'(': r'\28',
        r'|': r'\7c',
        r'<': r'\3c',
        r'/': r'\2f',
        r')': r'\29',
        r'=': r'\3d',
        r'~': r'\7e',
        r'&': r'\26',
        r'>': r'\3e',
        r'*': r'\2a'
    }

    for x, y in escape_vals.items():
        string = string.replace(x, y)

    return string.strip(" ")