code: def _create_shard_instructions(
      num_shards: int,
      in_filename_template: naming.ShardedFileTemplate,
      in_file_adapter: Type[file_adapters.FileAdapter],
      out_filename_template: naming.ShardedFileTemplate,
      out_file_adapter: Type[file_adapters.FileAdapter],
  ) -> list[ShardInstruction]:
      """Returns shard instructions for the given split."""
      if num_shards <= 0:
          raise ValueError("num_shards must be positive.")
      instructions = []
      for shard_index in range(num_shards):
          in_file_path = in_filename_template.sharded_filepath(
              shard_index=shard_index, num_shards=num_shards
          )
          out_file_path = out_filename_template.sharded_filepath(
              shard_index=shard_index, num_shards=num_shards
          )
          instructions.append(
              ShardInstruction(
                  in_path=in_file_path,
                  in_file_adapter=in_file_adapter,
                  out_path=out_file_path,
                  out_file_adapter=out_file_adapter,
              )
          )
      return instructions
  
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 1 for calling a global function with example usage: _create_shard_instructions(num_shards, in_filename_template, in_file_adapter, out_filename_template, out_file_adapter) and returns: instructions