def search_dico(a, x):
    """
    Returns the index of x in a if present, None elsewhere.
    """
    mn = 0
    mx = len(a) - 1
    i = 0

    while mx - mn > 1:
        i = (mn + mx) // 2
        if a[i] == x:
            return i
        elif x > a[i]:
            mn = i
        else:
            mx = i
    if a[mn] == x:
        return mn
    elif a[mx] == x:
        return mx
    else:
        return None