code: def _setup_config_parser(
      config_path: PathOrStr, validate=True
  ) -> SKLLConfigParser:
      """
      Return a config parser at a given path.
  
      Only implemented as a separate function to simplify testing.
  
      Parameters
      ----------
      config_path : :class:`skll.types.PathOrStr`
          The path to the configuration file.
  
      validate : bool, default=True
          Whether to validate the configuration file.
  
      Returns
      -------
      config : SKLLConfigParser
          A SKLL configuration object.
  
      Raises
      ------
      FileNotFoundError
          If the configuration file does not exist.
      """
      # initialize config parser with the given defaults
      config = SKLLConfigParser()
  
      # convert config_path to a Path object
      config_path = Path(config_path)
  
      # Read file if it exists
      if not config_path.exists():
          raise FileNotFoundError(
              f"The configuration file {config_path} does not exist."
          )
  
      config.read(config_path)
  
      if validate:
          config.validate()
  
      return config
  
imports: import configparser
  import itertools
  import logging
  import os
  from numbers import Number
  from os.path import basename, join
  from pathlib import Path
  from typing import Any, Dict, List, Optional, Set, Tuple, Union
  import numpy
  from ruamel.yaml import YAML
  from skll.data.readers import safe_float
  from skll.types import ClassMap, FoldMapping, LabelType, PathOrStr
  from skll.utils.constants import PROBABILISTIC_METRICS, VALID_FEATURE_SCALING_OPTIONS, VALID_SAMPLERS, VALID_TASKS
  from skll.utils.logging import get_skll_logger
  from .utils import _munge_featureset_name, _parse_and_validate_metrics, fix_json, load_cv_folds, locate_file
label_desc: Use image node_id 2 for calling a global function with example usage: _setup_config_parser(config_path, validate) and returns: config