code: def get_metric(metric, problem_type=None, metric_type=None) -> Scorer:
      """Returns metric function by using its name if the metric is str.
      Performs basic check for metric compatibility with given problem type.
      """
  
      if metric is not None and isinstance(metric, str):
          if metric == "soft_log_loss":
              if problem_type == QUANTILE:
                  raise ValueError(
                      f"{metric_type}={metric} can not be used for quantile problems"
                  )
              from .softclass_metrics import soft_log_loss
  
              return soft_log_loss
          if problem_type is not None:
              if problem_type not in METRICS:
                  raise ValueError(
                      f"Invalid problem_type '{problem_type}'. Valid problem types: {list(METRICS.keys())}"
                  )
              if metric not in METRICS[problem_type]:
                  valid_problem_types = _get_valid_metric_problem_types(
                      metric
                  )
                  if valid_problem_types:
                      raise ValueError(
                          f"{metric_type}='{metric}' is not a valid metric for problem_type='{problem_type}'. Valid problem_types for this metric: {valid_problem_types}"
                      )
                  else:
                      raise ValueError(
                          f"Unknown metric '{metric}'. "
                          f"Valid metrics for problem_type='{problem_type}':\n"
                          f"{list(METRICS[problem_type].keys())}"
                      )
              return METRICS[problem_type][metric]
          for pt in METRICS:
              if metric in METRICS[pt]:
                  return METRICS[pt][metric]
          all_available_metrics = dict()
          for pt in METRICS:
              all_available_metrics[pt] = list(METRICS[pt].keys())
          all_available_metrics[SOFTCLASS] = ["soft_log_loss"]
  
          raise ValueError(
              f"{metric_type}='{metric}' is an unknown metric, all available metrics by problem_type are:\n"
              f"{json.dumps(all_available_metrics, indent=2)}\n"
              f"You can also refer to "
              f"autogluon.core.metrics to see how to define your own {metric_type} function"
          )
      else:
          return metric
  
imports: import json
  from abc import ABCMeta, abstractmethod
  from functools import partial
  import numpy
  import scipy
  import scipy.stats
  import sklearn.metrics
  from ..constants import BINARY, MULTICLASS, QUANTILE, REGRESSION, SOFTCLASS
  from .None import classification_metrics, quantile_metrics
  from .classification_metrics import confusion_matrix
label_desc: Use image node_id 9 for calling a global function with example usage: get_metric(metric, problem_type, metric_type) and returns: metric, soft_log_loss, METRICS, METRICS