code: def _shard_instructions_for_split(
      split_info: splits_lib.SplitInfo,
      out_file_format: file_adapters.FileFormat,
      out_path: epath.Path,
      in_file_adapter: Type[file_adapters.FileAdapter],
      out_file_adapter: Type[file_adapters.FileAdapter],
  ) -> list[ShardInstruction]:
      """Returns shard instructions for the given split."""
      if split_info.filename_template is None:
          raise ValueError(
              f"Filename template for split {split_info.name} is empty."
          )
  
      in_filename_template = split_info.filename_template
      out_filename_template = in_filename_template.replace(
          data_dir=out_path, filetype_suffix=out_file_format.value
      )
      num_shards = len(split_info.shard_lengths)
      return _create_shard_instructions(
          num_shards=num_shards,
          in_filename_template=in_filename_template,
          in_file_adapter=in_file_adapter,
          out_filename_template=out_filename_template,
          out_file_adapter=out_file_adapter,
      )
  
imports: from collections.abc import Iterator
  import dataclasses
  from typing import Type
  from absl import logging
  from etils import epath
  from tensorflow_datasets.core import constants
  from tensorflow_datasets.core import dataset_info
  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.utils import py_utils
  from tensorflow_datasets.core.utils import type_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import apache_beam
label_desc: Use image node_id 2 for calling a global function with example usage: _shard_instructions_for_split(split_info, out_file_format, out_path, in_file_adapter, out_file_adapter) and returns: _create_shard_instructions