code: def assert_scoring(
      scoring,
      expected_keys=None,
      agg_periods=None,
      agg_func=None,
      relative_error_tolerance=None,
  ):
      """Checks if `scoring` has the expected keys and score functions
      defined by the other parameters.
  
      Parameters
      ----------
      scoring : `dict`
          ``scoring`` dictionary to check
      expected_keys : `set` [`str`] or None
          Expected keys in `scoring` dictionary.
          If None, does not check the keys.
      agg_periods : callable or None
          What was passed to `get_scoring_and_refit`
      agg_func : `int` or None
          What was passed to `get_scoring_and_refit`
      relative_error_tolerance : `float` or None
          What was passed to `get_scoring_and_refit`
          Must provide `relative_error_tolerance` to check FRACTION_OUTSIDE_TOLERANCE_NAME.
      """
      if expected_keys is not None:
          assert scoring.keys() == expected_keys
      # a few metrics to spot check
      name_func = {
          EvaluationMetricEnum.MeanAbsolutePercentError.get_metric_name(): EvaluationMetricEnum.MeanAbsolutePercentError.get_metric_func(),
          EvaluationMetricEnum.Quantile95.get_metric_name(): EvaluationMetricEnum.Quantile95.get_metric_func(),
          FRACTION_OUTSIDE_TOLERANCE_NAME: partial(
              fraction_outside_tolerance, rtol=relative_error_tolerance
          ),
      }
      for name, scorer in scoring.items():
          assert isinstance(scorer, _PredictScorerDF)
          assert scorer._sign == 1  # because greater_is_better=True
          if name in name_func:
              expected_func = get_score_func_with_aggregation(
                  score_func=name_func[name],
                  agg_periods=agg_periods,
                  agg_func=agg_func,
              )[0]
              assert_eval_function_equal(
                  scorer._score_func, expected_func
              )
  
imports: import warnings
  from functools import partial
  from typing import Optional
  import numpy
  import pandas
  from sklearn.model_selection import RandomizedSearchCV
  from sklearn.pipeline import Pipeline
  from greykite.common.constants import ACTUAL_COL
  from greykite.common.constants import PREDICTED_COL
  from greykite.common.constants import PREDICTION_BAND_COVERAGE
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.common.evaluation import fraction_outside_tolerance
  from greykite.common.python_utils import assert_equal
  from greykite.common.testing_utils import assert_eval_function_equal
  from greykite.framework.constants import FRACTION_OUTSIDE_TOLERANCE_NAME
  from greykite.framework.output.univariate_forecast import UnivariateForecast
  from greykite.framework.pipeline.pipeline import validate_pipeline_input
  from greykite.framework.pipeline.utils import get_score_func_with_aggregation
  from greykite.framework.utils.result_summary import summarize_grid_search_results
  from greykite.sklearn.estimator.simple_silverkite_estimator import SimpleSilverkiteEstimator
  from greykite.sklearn.sklearn_scorer import _PredictScorerDF
label_desc: Use image node_id 2 for calling a global function with example usage: assert_scoring(scoring, expected_keys, agg_periods, agg_func, relative_error_tolerance) without return types