def METHOD_NAME(metric: str, eval_set_index: int) -> None:
    def objective(trial: optuna.trial.Trial) -> float:
        train_x = np.asarray([[1.0], [2.0]])
        train_y = np.asarray([[1.0], [0.0]])
        valid_x = np.asarray([[1.0], [2.0]])
        valid_y = np.asarray([[1.0], [0.0]])
        if eval_set_index is None:
            eval_set = [(valid_x, valid_y)]
            pruning_callback = CatBoostPruningCallback(trial, metric)
        else:
            eval_set = [(valid_x, valid_y), (valid_x, valid_y)]
            pruning_callback = CatBoostPruningCallback(trial, metric, eval_set_index)
        param = {
            "objective": "Logloss",
            "eval_metric": metric,
        }
        gbm = cb.CatBoostClassifier(**param)
        gbm.fit(
            train_x,
            train_y,
            eval_set=eval_set,
            verbose=0,
            callbacks=[pruning_callback],
        )
        # Invoke pruning manually.
        pruning_callback.check_pruned()
        return 1.0
    study = optuna.create_study(pruner=DeterministicPruner(True))
    study.optimize(objective, n_trials=1)
    assert study.trials[0].state == optuna.trial.TrialState.PRUNED
    study = optuna.create_study(pruner=DeterministicPruner(False))
    study.optimize(objective, n_trials=1)
    assert study.trials[0].state == optuna.trial.TrialState.COMPLETE
    assert study.trials[0].value == 1.0