def _invert_indices(arr, range_max):
    """return all indices from range(range_max) that are not in arr as a list"""
    inv = []
    for j in range(range_max):
        if j not in arr:
            inv.append(j)
    return inv