<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _compute_operation(string, idx):
 # type: (str, int) -> Optional[int] """ Tries to compute the LDAP operation at the given index Valid operations are : * & : AND * | : OR * ! : NOT :param string: A LDAP filter string :param idx: An index in the given string :return: The corresponding operator (AND, OR or NOT) """

    operator = string[idx]
    if operator == "&":
        return AND
    elif operator == "|":
        return OR
    elif operator == "!":
        return NOT

    return None