def _get_coverage_to_confident_error_idxs(coverages, preds, confidences, y_true
    ):
    """Returns a list of confident error indices for each coverage"""
    sorted_confidences = list(sorted(confidences, reverse=True))
    cov_to_confident_error_idxs = []
    for coverage in coverages:
        threshold = sorted_confidences[int(coverage * len(preds))]
        confident_mask = confidences >= threshold
        confident_error_mask = (y_true != preds) * confident_mask
        confident_error_idx = confident_error_mask.nonzero()[0]
        cov_to_confident_error_idxs.append(confident_error_idx)
    return cov_to_confident_error_idxs
