def get_roc_for_fpr(
    attack_proba: np.ndarray,
    attack_true: np.ndarray,
    target_model_labels: np.ndarray | None = None,
    targeted_fpr: float = 0.001,
) -> list[tuple[FPR, TPR, THR]] | list[tuple[int, FPR, TPR, THR]]:
    """
    Compute the attack TPR, THRESHOLD and achieved FPR based on the targeted FPR. This implementation supports only
    binary attack prediction labels {0,1}. The returned THRESHOLD defines the decision threshold on the attack
    probabilities (meaning if p < THRESHOLD predict 0, otherwise predict 1)
    | Related paper link: https://arxiv.org/abs/2112.03570

    :param attack_proba: Predicted attack probabilities.
    :param attack_true: True attack labels.
    :param targeted_fpr: the targeted False Positive Rate, attack accuracy will be calculated based on this FPRs.
     If not supplied, get_roc_for_fpr will be computed for `0.001` FPR.
    :param target_model_labels: Original labels, if provided the Accuracy and threshold will be calculated per each
     class separately.
    :return: list of tuples the contains (original label (if target_model_labels is provided),
    Achieved FPR, TPR, Threshold).
    """

    if attack_proba.shape[0] != attack_true.shape[0]:
        raise ValueError("Number of rows in attack_pred and attack_true do not match")
    if target_model_labels is not None and attack_proba.shape[0] != target_model_labels.shape[0]:
        raise ValueError("Number of rows in target_model_labels and attack_pred do not match")

    results = []

    if target_model_labels is not None:
        values, _ = np.unique(target_model_labels, return_counts=True)
        for value in values:
            idxs = np.where(target_model_labels == value)[0]
            fpr, tpr, thr = _calculate_roc_for_fpr(
                y_proba=attack_proba[idxs], y_true=attack_true[idxs], targeted_fpr=targeted_fpr
            )
            results.append((value, fpr, tpr, thr))
        return results

    fpr, tpr, thr = _calculate_roc_for_fpr(y_proba=attack_proba, y_true=attack_true, targeted_fpr=targeted_fpr)
    return [(fpr, tpr, thr)]

    Compute the attack TPR, THRESHOLD and achieved FPR based on the targeted FPR. This implementation supports only
    binary attack prediction labels {0,1}. The returned THRESHOLD defines the decision threshold on the attack
    probabilities (meaning if p < THRESHOLD predict 0, otherwise predict 1)
    | Related paper link: https://arxiv.org/abs/2112.03570

    :param attack_proba: Predicted attack probabilities.
    :param attack_true: True attack labels.
    :param targeted_fpr: the targeted False Positive Rate, attack accuracy will be calculated based on this FPRs.
     If not supplied, get_roc_for_fpr will be computed for `0.001` FPR.
    :param target_model_labels: Original labels, if provided the Accuracy and threshold will be calculated per each
     class separately.
    :return: list of tuples the contains (original label (if target_model_labels is provided),
    Achieved FPR, TPR, Threshold).
    
art/metrics/privacy/worst_case_mia_score.py