code: def check_scoring(scoring, allow_y_pred_benchmark=False, obj=None):
      """Validate a scorer parameter and coerce to sktime BaseMetric.
  
      Parameters
      ----------
      scoring : object to validate. For successful validation, must be one of
  
          * sktime metric object, instance of descendant of `BaseMetric`
          * a callable with signature
            `(y_true: 1D np.ndarray, y_pred: 1D np.ndarray) -> float`,
            assuming `np.ndarray`-s being of the same length, and lower being better.
          * a string, resolvable by registry.resolve_alias to one of the above
          * None
  
      allow_y_pred_benchmark : boolean, optional, default=False
          whether to allow scorer classes with `requires-y-pred-benchmark` tag = `True`
  
      obj : object or class, or None, optional, default=None
          if not None, will be used as a reference in the error message
  
      Returns
      -------
      scoring : input `scoring` coerced to instance of sktime `BaseMetric` descendant
  
          * if `scoring` was sktime metric, returns `scoring`
          * if `scoring` was `None`, returns `MeanAbsolutePercentageError()`
          * if `scoring` was a callable, returns dynamic scoring metric class,
            as created by `performance_metrics.forecasting.make_forecasting_scorer`
  
      Raises
      ------
      TypeError, if `scoring` is not a callable
      NotImplementedError
          if allow_y_pred_benchmark=False and metric requires y_pred_benchmark argument
      """
      # Note symmetric=True is default arg for MeanAbsolutePercentageError
      from sktime.performance_metrics.base import BaseMetric
      from sktime.performance_metrics.forecasting import (
          MeanAbsolutePercentageError,
          make_forecasting_scorer,
      )
  
      if scoring is None:
          return MeanAbsolutePercentageError()
  
      if obj is not None:
          obj_str = f" of {str(obj)}"
      else:
          obj_str = ""
  
      msg = (
          f"scoring parameter{obj_str} must be one of the following: "
          "(1) an sktime metric, descendant of BaseMetric; (2) a callable with signature "
          "(y_true: 1D np.ndarray, y_pred: 1D np.ndarray) -> float, "
          "assuming np.ndarrays being of the same length, and lower being better; "
          "(3) a string, resolvable by registry.resolve_alias to an object of either "
          "type (1) or (2)"
      )
  
      # deal with case (3) first - if string, try to resolve and return
      if isinstance(scoring, str):
          # lazy import of sktime.registry to avoid circular imports
          # and to ensure maximal decoupling from registry
          from sktime.registry import resolve_alias
  
          return resolve_alias(scoring)
  
      # check case (1) and case (2)
      # note: BaseMetric descendants are callable, so this is the same as
      # if not callable(scoring) and not isinstance(scoring, BaseMetric)
      if not callable(scoring):
          raise TypeError(msg)
  
      if not isinstance(scoring, BaseMetric):
          scoring = make_forecasting_scorer(
              func=scoring, greater_is_better=False
          )
  
      if hasattr(scoring, "get_class_tag"):
          scoring_req_bench = scoring.get_class_tag(
              "requires-y-pred-benchmark", False
          )
          if scoring_req_bench and not allow_y_pred_benchmark:
              msg = (
                  "Scoring requiring benchmark forecasts (y_pred_benchmark) are not "
                  "fully supported yet. Please use a performance metric that does not "
                  "require y_pred_benchmark as a keyword argument in its call signature."
              )
              raise NotImplementedError(msg)
  
      return scoring
  
file_path: sktime/sktime/utils/validation/forecasting.py
imports: from datetime import timedelta
  from typing import Optional, Union
  import numpy
  import pandas
  from sklearn.base import clone, is_regressor
  from sklearn.ensemble import GradientBoostingRegressor
  from sktime.utils.validation import array_is_datetime64, array_is_int, is_date_offset, is_int, is_timedelta
  from sktime.utils.validation.series import check_equal_time_index, check_series
label_desc: Use image node_id 10 for calling a global function with example usage: check_scoring(scoring, allow_y_pred_benchmark, obj) and returns: scoring, MeanAbsolutePercentageError, resolve_alias