class_docstr: Should be in format {config_name: {**config_params}}.
class_docstr_tok: ["Should","be","in","format","{","config_name",":","{","*","*","config_params","}","}","."]
code: def _raise_if_data_files_field_not_valid(metadata_config: dict):
      yaml_data_files = metadata_config.get("data_files")
      if yaml_data_files is not None:
          yaml_error_message = textwrap.dedent(
              f"""
                  Expected data_files in YAML to be either a string or a list of strings
                  or a list of dicts with two keys: 'split' and 'path', but got {yaml_data_files}
                  Examples of data_files in YAML:
  
                     data_files: data.csv
  
                     data_files: data/*.png
  
                     data_files:
                      - part0/*
                      - part1/*
  
                     data_files:
                      - split: train
                        path: train/*
                      - split: test
                        path: test/*
  
                     data_files:
                      - split: train
                        path:
                        - train/part1/*
                        - train/part2/*
                      - split: test
                        path: test/*
                  """
          )
          if not isinstance(yaml_data_files, (list, str)):
              raise ValueError(yaml_error_message)
          if isinstance(yaml_data_files, list):
              for yaml_data_files_item in yaml_data_files:
                  if (
                      not isinstance(yaml_data_files_item, (str, dict))
                      or isinstance(yaml_data_files_item, dict)
                      and not (
                          len(yaml_data_files_item) == 2
                          and "split" in yaml_data_files_item
                          and isinstance(
                              yaml_data_files_item.get("path"),
                              (str, list),
                          )
                      )
                  ):
                      raise ValueError(yaml_error_message)
  
imports: import textwrap
  from collections import Counter
  from itertools import groupby
  from operator import itemgetter
  from pathlib import Path
  from typing import Any, ClassVar, Dict, List, Optional, Tuple, Union
  import yaml
  from huggingface_hub import DatasetCardData
  from ..config import METADATA_CONFIGS_FIELD
  from ..info import DatasetInfo, DatasetInfosDict
  from ..utils.logging import get_logger
  from .deprecation_utils import deprecated
label_desc: Use image node_id 1 for calling the MetadataConfigs obj's underlying member method code with example usage: obj._raise_if_data_files_field_not_valid(metadata_config) without return types