code: def count_records_per_label(input_examples):
      """Shuffles the input_examples in a effectively random order."""
  
      def label_example(input_bytes):
          """Returns the label of input_example."""
          example = tf.train.Example.FromString(input_bytes)
          label = example.features.feature["label"].int64_list.value[0]
          return label
  
      return (
          input_examples
          | "LabelExample" >> beam.Map(lambda x: (label_example(x), x))
          | "CountPerLabel" >> beam.combiners.Count.PerKey()
          | "ToString"
          >> beam.Map(lambda kv: "# class{}: {}\n".format(kv[0], kv[1]))
          | "Concat1" >> beam.CombineGlobally("".join)
      )
  
file_path: deepvariant/tools/shuffle_tfrecords_beam.py
imports: import argparse
  import hashlib
  import logging
  import os
  import textwrap
  import apache_beam
  from apache_beam import coders
  from apache_beam.options.pipeline_options import PipelineOptions
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling a global function with example usage: count_records_per_label(input_examples) and returns: unknown, label