code: def _parse_and_validate_metrics(
      metrics: str, option_name: str, logger=None
  ) -> List[str]:
      """
      Parse and validate string containing list of metrics.
  
      Given a string containing a list of metrics, this function
      parses that string into a list and validates some specific
      metric names.
  
      Parameters
      ----------
      metrics : str
          A string containing a list of metrics.
  
      option_name : str
          The name of the option with which the metrics are associated.
  
      logger : Optional[logging.Logger], default=None
          A logging object.
  
      Returns
      -------
      metrics : List[str]
          A list of metrics for the given option.
  
      Raises
      ------
      TypeError
          If the given string cannot be converted to a list.
  
      ValueError
          If "mean_squared_error" is specified as a metric.
      """
      # create a logger if one was not passed in
      if not logger:
          logger = logging.getLogger(__name__)
  
      # make sure the given metrics data type is a list
      # and parse it correctly
      yaml = YAML(typ="safe", pure=True)
      metrics = yaml.load(fix_json(metrics))
      if not isinstance(metrics, list):
          raise TypeError(
              f"{option_name} should be a list, not a "
              f"{type(metrics)}."
          )
  
      # `mean_squared_error` is no longer supported.
      # It has been replaced by `neg_mean_squared_error`
      if "mean_squared_error" in metrics:
          raise ValueError(
              'The metric "mean_squared_error" is no longer '
              "supported. please use the metric "
              '"neg_mean_squared_error" instead.'
          )
  
      return metrics
  
file_path: skll/skll/config/utils.py
imports: import csv
  import errno
  import logging
  from pathlib import Path
  from typing import Iterable, List, Union
  from ruamel.yaml import YAML
  from skll.types import FoldMapping, PathOrStr
label_desc: Use image node_id 5 for calling a global function with example usage: _parse_and_validate_metrics(metrics, option_name, logger) and returns: metrics