code: def _load_splits(
      *,
      split_infos: Union[
          None, epath.PathLike, Sequence[split_lib.SplitInfo]
      ],
      file_infos: Sequence[naming.FilenameInfo],
      filename_template: naming.ShardedFileTemplate,
  ) -> split_lib.SplitDict:
      """Load the SplitDict which can be passed to DatasetInfo."""
      split_names = sorted(set(f.split for f in file_infos))
  
      if split_infos is None:  # Auto-compute the split-infos
          split_infos = compute_split_utils.compute_split_info(
              filename_template=filename_template
          )
      # Load the Sequence[SplitInfo]
      elif isinstance(split_infos, epath.PathLikeCls):
          split_infos = compute_split_utils.split_infos_from_path(
              split_names=split_names,
              filename_template=filename_template,
          )
      elif all(isinstance(s, split_lib.SplitInfo) for s in split_infos):
          given_splits = sorted([s.name for s in split_infos])
          if given_splits != split_names:
              raise ValueError(
                  f"Splits {given_splits} do not match {split_names}"
              )
      else:
          raise TypeError(f"Invalid split info: {split_infos}")
  
      split_protos = [s.to_proto() for s in split_infos]
      return split_lib.SplitDict.from_proto(
          repeated_split_infos=split_protos,
          filename_template=filename_template,
      )
  
file_path: datasets/tensorflow_datasets/core/folder_dataset/write_metadata_utils.py
imports: from collections.abc import Sequence
  import os
  from typing import Union
  from etils import epath
  from tensorflow_datasets.core import dataset_info
  from tensorflow_datasets.core import features
  from tensorflow_datasets.core import file_adapters
  from tensorflow_datasets.core import naming
  from tensorflow_datasets.core import read_only_builder
  from tensorflow_datasets.core import splits
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.folder_dataset import compute_split_utils
label_desc: Use image node_id 5 for calling a global function with example usage: _load_splits() and returns: split_lib