code: def get_formatted_target_metric(
      target_metric: Union[tuple, str, None],
      metrics: dict,
      default_dataset: str = "oof",
  ) -> Tuple[str, str]:
      """Return a properly formatted target_metric tuple for use with navigating evaluation results
  
      Parameters
      ----------
      target_metric: Tuple, String, or None
          Path denoting metric to be used. If tuple, the first value should be in ['oof', 'holdout',
          'in_fold'], and the second value should be the name of a metric supplied in `metrics`.
          If str, should be one of the two values from the tuple form. Else, a value will be chosen
      metrics: Dict
          Properly formatted `metrics` as produced by :func:`metrics.format_metrics`, in which
          keys are strings identifying metrics, and values are instances of :class:`metrics.Metric`.
          See the documentation of :func:`metrics.format_metrics` for more information on
          different metrics formats
      default_dataset: {"oof", "holdout", "in_fold"}, default="oof"
          The default dataset type value to use if one is not provided
  
      Returns
      -------
      target_metric: Tuple
          A formatted target_metric containing two strings: a dataset_type, followed by a metric name
  
      Examples
      --------
      >>> get_formatted_target_metric(('holdout', 'roc_auc_score'), format_metrics(['roc_auc_score', 'f1_score']))
      ('holdout', 'roc_auc_score')
      >>> get_formatted_target_metric(('holdout',), format_metrics(['roc_auc_score', 'f1_score']))
      ('holdout', 'roc_auc_score')
      >>> get_formatted_target_metric('holdout', format_metrics(['roc_auc_score', 'f1_score']))
      ('holdout', 'roc_auc_score')
      >>> get_formatted_target_metric('holdout', format_metrics({'roc': 'roc_auc_score', 'f1': 'f1_score'}))
      ('holdout', 'roc')
      >>> get_formatted_target_metric('roc_auc_score', format_metrics(['roc_auc_score', 'f1_score']))
      ('oof', 'roc_auc_score')
      >>> get_formatted_target_metric(None, format_metrics(['f1_score', 'roc_auc_score']))
      ('oof', 'f1_score')"""
      ok_datasets = ["oof", "holdout", "in_fold"]
  
      if isinstance(target_metric, str):
          target_metric = (target_metric,)
      elif target_metric is None:
          target_metric = (default_dataset,)
  
      if not isinstance(target_metric, tuple):
          raise TypeError(
              f"`target_metric` should be: tuple, str, or None. Received {target_metric}"
          )
      elif len(target_metric) > 2:
          raise ValueError(
              f"`target_metric` should be tuple of length 2. Received {target_metric}"
          )
      elif len(target_metric) == 1:
          if target_metric[0] in ok_datasets:
              # Just a dataset was provided - Need metric name
              first_metric_key = list(metrics.keys())[0]
              target_metric = target_metric + (first_metric_key,)
              # TODO: Above will cause problems if `Environment.metrics_params['oof']` is not "all"
          else:
              # Just a metric name was provided - Need dataset type
              target_metric = (default_dataset,) + target_metric
  
      if not any([_ == target_metric[0] for _ in ok_datasets]):
          raise ValueError(
              f"`target_metric`[0] must be in {ok_datasets}. Received {target_metric}"
          )
      if not target_metric[1] in metrics.keys():
          raise ValueError(
              f"target_metric[1]={target_metric[1]} not in metrics={metrics}"
          )
  
      return target_metric
  
imports: from collections import OrderedDict
  from contextlib import suppress
  import numpy
  import pandas
  from typing import Dict, Iterable, List, Tuple, Union
  from sklearn import metrics
  from sklearn.utils.multiclass import type_of_target, unique_labels
label_desc: Use image node_id 2 for calling a global function with example usage: get_formatted_target_metric(target_metric, metrics, default_dataset) and returns: target_metric