def escape_query(query):
    """Escapes certain filter characters from an LDAP query."""
    return query.replace('\\', '\\5C').replace('*', '\\2A').replace('(', '\\28'
        ).replace(')', '\\29')
