import bisect


def find_index(seq, val):
    """Assume ``seq`` is sorted and search for the position of ``val``."""
    i = bisect.bisect_left(seq, val)
    if i != len(seq) and seq[i] == val:
        return i
    raise ValueError(f'{val} was not found')