def find_index_or_nearest(iterable, item):
    """ Return the index of an item or indexes of the nearest values if the not found. """
    beg = 0
    end = len(iterable) - 1
    while beg <= end:
        mid = beg + (end - beg) // 2
        if iterable[mid] == item:
            return mid
        elif iterable[mid] < item:
            beg = mid + 1
        else:
            end = mid - 1
    else:
        return [end, beg]