implementation and testing of binary search in python