def binary_search(lst, item):
    """ Perform binary search on a sorted list. 
    Return the index of the element if it is in
    the list, otherwise return -1.
    """
    low = 0
    high = len(lst) - 1
    while low < high:
        middle = (high+low)/2
        current = lst[middle]
        if current == item:
            return middle
        elif current < item:
            low = middle+1
        elif current > item:
            high = middle-1
    if lst[low] == item:
        return low
    return -1