def lastindex(lst, which):
    """Finds the last occurrence of `which` in the list.

    If `which` is not in the list, raise an ValueError.

    """
    lst.reverse()
    try:
        return len(lst) - lst.index(which) - 1
    finally:
        lst.reverse()
