<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _fit_and_score(est, x, y, scorer, train_index, test_index, parameters, fit_params, predict_params):
 """Train survival model on given data and return its score on test data"""

    X_train, y_train = _safe_split(est, x, y, train_index)
    train_params = fit_params.copy()

    # Training
    est.set_params(**parameters)
    est.fit(X_train, y_train, **train_params)

    # Testing
    test_predict_params = predict_params.copy()
    X_test, y_test = _safe_split(est, x, y, test_index, train_index)

    score = scorer(est, X_test, y_test, **test_predict_params)
    if not isinstance(score, numbers.Number):
        raise ValueError("scoring must return a number, got %s (%s) instead."
                         % (str(score), type(score)))

    return score