fix binary search in python