code: def split_file_instruction(
      file_instruction: FileInstruction,
      num_splits: int,
  ) -> List[FileInstruction]:
      """Instructions for reading the given file instruction in several splits.
  
      Note that this function may return fewer splits than `num_splits` in case the
      number of examples cannot be split into that many. For example, if
      `file_instruction` has `take=1` and `num_splits=2`, then only a single
      file instruction is returned.
  
      Arguments:
        file_instruction: the file instruction that should be split into multiple
          file instructions. It is currently not supported to have `skip>0` or not
          take all examples in the file.
        num_splits: the number of splits the file instruction should be split into.
  
      Returns:
        list of file instructions into which it is split.
      """
      if not file_instruction.takes_all or file_instruction.skip > 0:
          raise ValueError(
              "Only file instructions that read all rows are supported!"
          )
      examples_per_split = math.ceil(file_instruction.take / num_splits)
      splits = []
      index = file_instruction.skip
      while index < file_instruction.examples_in_shard:
          # If there are fewer examples left in the file than `examples_per_split`,
          # then only take what's left.
          take = min(
              examples_per_split,
              file_instruction.examples_in_shard - index,
          )
          splits.append(file_instruction.replace(skip=index, take=take))
          index += take
      return splits
  
file_path: datasets/tensorflow_datasets/core/utils/shard_utils.py
imports: from __future__ import annotations
  import dataclasses
  import math
  import os
  from typing import Any, List, Optional, Sequence
label_desc: Use image node_id 1 for calling a global function with example usage: split_file_instruction(file_instruction, num_splits) and returns: splits