code: def _get_metric(metric: str) -> Callable:
      """
      Get the corresponding scikit-learn function to calculate the metric.
  
      Parameters
      ----------
      metric : str
          Metric used to quantify the goodness of fit of the model. Available metrics:
          {'mean_squared_error', 'mean_absolute_error',
           'mean_absolute_percentage_error', 'mean_squared_log_error'}
  
      Returns
      -------
      metric : Callable
          scikit-learn function to calculate the desired metric.
  
      """
  
      if metric not in [
          "mean_squared_error",
          "mean_absolute_error",
          "mean_absolute_percentage_error",
          "mean_squared_log_error",
      ]:
          raise ValueError(
              (
                  f"Allowed metrics are: 'mean_squared_error', 'mean_absolute_error', "
                  f"'mean_absolute_percentage_error' and 'mean_squared_log_error'. Got {metric}."
              )
          )
  
      metrics = {
          "mean_squared_error": mean_squared_error,
          "mean_absolute_error": mean_absolute_error,
          "mean_absolute_percentage_error": mean_absolute_percentage_error,
          "mean_squared_log_error": mean_squared_log_error,
      }
  
      metric = metrics[metric]
  
      return metric
  
imports: from typing import Union, Tuple, Optional, Callable
  import numpy
  import pandas
  import warnings
  import logging
  from copy import deepcopy
  from joblib import Parallel, delayed, cpu_count
  from tqdm.auto import tqdm
  from sklearn.metrics import mean_squared_error, mean_absolute_error, mean_absolute_percentage_error, mean_squared_log_error
  from sklearn.model_selection import ParameterGrid
  from sklearn.model_selection import ParameterSampler
  import optuna
  from optuna.samplers import TPESampler, RandomSampler
  from ..exceptions import LongTrainingWarning
  from ..utils import check_backtesting_input
  from ..utils import initialize_lags_grid
  from ..utils import select_n_jobs_backtesting
label_desc: Use image node_id 2 for calling a global function with example usage: _get_metric(metric) and returns: metric