code: def get_num_examples(dataset: tf.data.Dataset) -> int:
      """Returns the number of examples in the dataset by iterating over it once."""
      return dataset.reduce(np.int64(0), lambda x, _: x + 1).numpy()
  
imports: from typing import Any, Dict, Optional
  from absl import logging
  import numpy
  import tensorflow
  import tensorflow_datasets
  import tensorflow_text
  import vocabulary
label_desc: Use image node_id 2 for calling a global function with example usage: get_num_examples(dataset) and returns: dataset