def binary_search_std_lib(sorted_collection, item):
 index = bisect.bisect_left(sorted_collection, item)
 if ((index != len(sorted_collection)) and (sorted_collection[index] == item)):
  return index
 return None

def binary_search_std_lib ( sorted_collection , item ) : index = bisect . bisect_left ( sorted_collection , item ) if ( ( index != len ( sorted_collection ) ) and ( sorted_collection [ index ] == item ) ) : return index return None
pure implementation of binary search algorithm in python using stdlib be careful collection must be sorted .