code: def _get_single_tfds_dataset(
      builder: tfds.core.DatasetBuilder,
      split: str,
      batch_size: int,
      preprocess_fn: preprocess_spec.PreprocessFn,
      rng: Any,
      shuffle: bool = False,
      shuffle_buffer_size: int = 1000,
      cache: bool = False,
  ) -> tf.data.Dataset:
      """Creates dataset from builder and applies pre-mosaic preprocessing.
  
      Args:
        builder: TFDS dataset builder.
        split: Train/test/validation split.
        batch_size: Batch size.
        preprocess_fn: Preprocess function with pre-mosaic ops.
        rng: Random seed.
        shuffle: Whether to shuffle.
        shuffle_buffer_size: Shuffle buffer size.
        cache: Whether to cache the dataset.
  
      Returns:
        tf.data.Dataset with pre-mosaic preprocessing applied.
      """
  
      host_split = deterministic_data.get_read_instruction_for_host(
          split,
          dataset_info=builder.info,
          remainder_options=deterministic_data.RemainderOptions.DROP,
      )
  
      ds = deterministic_data.create_dataset(
          builder,
          split=host_split,
          preprocess_fn=preprocess_fn,
          cache=cache,
          batch_dims=[batch_size],
          rng=rng,
          num_epochs=None,  # None = repeat forever.
          shuffle=shuffle,
          shuffle_buffer_size=shuffle_buffer_size,
      )
  
      return ds
  
imports: import dataclasses
  import functools
  from typing import Any, Dict, Optional, Sequence
  from clu import deterministic_data
  from clu import preprocess_spec
  from flax import jax_utils
  import jax
  import jax.numpy
  import ml_collections
  from scenic.dataset_lib import dataset_utils
  from scenic.dataset_lib import datasets
  from scenic.projects.owl_vit.preprocessing import image_ops
  from scenic.projects.owl_vit.preprocessing import label_ops
  from scenic.projects.owl_vit.preprocessing import mosaic
  import tensorflow
  import tensorflow_datasets
label_desc: Use image node_id 3 for calling a global function with example usage: _get_single_tfds_dataset(builder, split, batch_size, preprocess_fn, rng, shuffle, shuffle_buffer_size, cache) and returns: ds