code: def load_cv_folds(
      folds_file: PathOrStr, ids_to_floats=False
  ) -> FoldMapping:
      """
      Load cross-validation folds from a CSV file.
  
      The CSV file must contain two columns: example ID and fold ID (and a header).
  
      Parameters
      ----------
      folds_file : :class:`skll.types.PathOrStr`
          The path to a folds file to read.
  
      ids_to_floats : bool, default=False
          Whether to convert IDs to floats.
  
      Returns
      -------
      :class:`skll.types.FoldMapping`
          Dictionary with example IDs as the keys and fold IDs as the values.
          If `ids_to_floats` is set to `True`, the example IDs are floats but
          otherwise they are strings.
  
      Raises
      ------
      ValueError
          If example IDs cannot be converted to floats and `ids_to_floats` is `True`.
      """
      with open(folds_file) as f:
          reader = csv.reader(f)
          next(reader)  # discard the header
          res = {}
          for row in reader:
              example_id: Union[float, str] = row[0]
              fold_id: str = row[1]
              if ids_to_floats:
                  try:
                      example_id = float(example_id)
                  except ValueError:
                      raise ValueError(
                          "You set ids_to_floats to true, but ID "
                          f"{row[0]} could not be converted to "
                          "float"
                      )
              res[example_id] = fold_id
  
      return res
  
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 2 for calling a global function with example usage: load_cv_folds(folds_file, ids_to_floats) and returns: res