def bisect_index(a, x):
i = bisect.bisect_left(a, x)<EOL>if i != len(a) and a[i] == x:<EOL><INDENT>return i<EOL><DEDENT>raise ValueError<EOL>
Find the leftmost index of an element in a list using binary search.

    Parameters
    ----------
    a: list
        A sorted list.
    x: arbitrary
        The element.

    Returns
    -------
    int
        The index.