def bi_contains(lst, item):
    """ efficient `item in lst` for sorted lists """
return item <= lst[-1] and lst[bisect_left(lst, item)] == item
Most efficient way for a lookup/search in a huge list (python)