code: def get_sharded_files(
      data_path: str,
      fraction_data: float = 1.0,
      num_groups: Optional[int] = None,
      group_index: Optional[int] = None,
  ) -> List[str]:
      """Returns a list of shards, which may be postprocessed.
  
      Args:
        data_path: Path to the data, either sharded or a single file.
        fraction_data: Fraction of the data to be consumed. Only that fraction of
          the shards is returned.
        num_groups: Number of groups to split the data. All the shards will be split
          in `num_groups` groups (of approximately same number of files) and the
          given `group_index` group only will be returned. This is useful when
          distributing the data over multiple hosts, which will make sure that the
          same shard is not processed in two different hosts. If `num_groups` is
          provided `group_index` must be provided as well.
        group_index: Index of the group of data being returned. See `num_groups`.
  
      Returns:
        A list of shard filenames.
  
      Raises:
        ValueError: If `fraction_data` is not between 0 and 1.
        ValueError: If `num_groups` requested is not consistent with the number of
          shards available.
        ValueError: If `group_index` >= `num_groups`
        ValueError: If only one of `num_groups` and `group_index` is given.
      """
      if fraction_data <= 0 or fraction_data > 1:
          raise ValueError(
              f"The fraction of data must be in (0, 1] but is {fraction_data}."
          )
  
      if file_utils.is_sharded_file_spec(data_path):
          shards = list(
              file_utils.generate_sharded_filenames(data_path)
          )
      else:
          shards = [data_path]
  
      num_used_shards = int(np.ceil(fraction_data * len(shards)))
      shards = shards[:num_used_shards]
  
      if num_groups is None and group_index is None:
          return shards
      if num_groups is None or group_index is None:
          raise ValueError(
              "Both `num_groups` and `group_index` should be specified."
          )
      if group_index >= num_groups:
          raise ValueError(
              f"Cannot request index {group_index} of {num_groups} groups"
          )
      if num_groups > num_used_shards:
          raise ValueError(
              f"After applying `fraction_data={fraction_data}` we have "
              f"{num_used_shards} data shards, which cannot be split into "
              f"{num_groups} groups."
          )
  
      split_shard_ids = np.array_split(
          np.arange(num_used_shards), num_groups
      )
      begin_loc = split_shard_ids[group_index][0]
      end_loc = split_shard_ids[group_index][-1] + 1
      shards = shards[begin_loc:end_loc]
      return shards
  
imports: import functools
  import os
  from typing import Dict, Iterator, List, Optional, Text, Tuple, Union
  from absl import logging
  from dmvr import builders
  from dmvr import modalities
  from dmvr import video_dataset
  from flax import jax_utils
  import jax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.dataset_lib import dataset_utils
  from scenic.dataset_lib import datasets
  from scenic.dataset_lib import video_ops
  from scenic.projects.vivit.data import file_utils
  import tensorflow
label_desc: Use image node_id 1 for calling a global function with example usage: get_sharded_files(data_path, fraction_data, num_groups, group_index) and returns: shards, shards