code: def _get_kwarg(kwarg, metric_name="Metric", **kwargs):
      """Pop a kwarg from kwargs and raise warning if kwarg not present."""
      kwarg_ = kwargs.pop(kwarg, None)
      if kwarg_ is None:
          msg = "".join(
              [
                  f"{metric_name} requires `{kwarg}`. ",
                  f"Pass `{kwarg}` as a keyword argument when calling the metric.",
              ]
          )
          raise ValueError(msg)
      return kwarg_
  
imports: import numpy
  from scipy.stats import gmean
  from sklearn.metrics import mean_absolute_error
  from sklearn.metrics import mean_squared_error
  from sklearn.metrics import median_absolute_error
  from sklearn.metrics._regression import _check_reg_targets
  from sklearn.utils.stats import _weighted_percentile
  from sklearn.utils.validation import check_consistent_length
  from sktime.utils.stats import _weighted_geometric_mean
label_desc: Use image node_id 1 for calling a global function with example usage: _get_kwarg(kwarg, metric_name) and returns: kwarg_