def METHOD_NAME(y_true, y_pred):
    tn, fp, fn, tp = confusion_matrix(y_true, y_pred).ravel()
    if metric == "fpr":
        return fp / (fp + tn)
    elif metric == "tnr":
        return tn / (fp + tn)
    elif metric == "fnr":
        return fn / (fn + tp)
    elif metric == "tpr":
        return tp / (fn + tp)
    else:
        raise ValueError(f"Invalid metric chosen; must be one of {valid_perf_metrics}; got '{metric}'")