def binary_search(a, value):
    """
    Searches a value in a (sorted) list. Return the index if found, otherwise
    returns <None>.
    """
    start = 0
    end = len(a) - 1

    while (start <= end):

        i = (start + end) // 2          # Middle point

        # If found the value
        if (a[i] == value):
            return i

        # If not found the value
        else:
            if (a[i] > value):
                end = i - 1             # Check left side
            else:
                start = i + 1           # Check right side

    return None