def find_index(token, low, high, features):  # binary search to find element index in list
    """
    # Binary search helper method
    # helps finding token index
    # with O(log n) time whereas
    # np.where() will need O(n)
    """
    if high >= low:
        mid = int((high + low) / 2)

        if features[mid] == token:
            return mid
        elif features[mid] > token:
            return find_index(token, low, mid - 1, features)
        else:
            return find_index(token, mid + 1, high, features)

    return -1