code: def create_parse_example_fn(
      config: ml_collections.ConfigDict,
  ) -> Callable[
      [tf.train.Example, Tuple[int, int, int]],
      Tuple[tf.Tensor, tf.Tensor],
  ]:
      """Generates a function for parsing tf.train.Examples."""
  
      preprocess_fn = keras_modeling.get_model_preprocess_fn(config)
  
      def parse_example(
          example: tf.train.Example,
          input_shape: Tuple[int, int, int],
      ) -> Tuple[tf.Tensor, tf.Tensor]:
          """Parses a serialized tf.Example, preprocesses the image, and one-hot encodes the label."""
          proto_features = {
              "image/encoded": tf.io.FixedLenFeature((), tf.string),
              "variant/encoded": tf.io.FixedLenFeature((), tf.string),
              "alt_allele_indices/encoded": tf.io.FixedLenFeature(
                  (), tf.string
              ),
              "label": tf.io.FixedLenFeature((1), tf.int64),
          }
  
          parsed_features = tf.io.parse_single_example(
              serialized=example, features=proto_features
          )
          image = tf.io.decode_raw(
              parsed_features["image/encoded"], tf.uint8
          )
          image = tf.reshape(image, input_shape)
          image = tf.cast(image, tf.float32)
  
          # Preprocess image
          if preprocess_fn:
              image = preprocess_fn(image)
          label = tf.keras.layers.CategoryEncoding(
              num_tokens=dv_constants.NUM_CLASSES, output_mode="one_hot"
          )(parsed_features["label"])
  
          return image, label
  
      return parse_example
  
imports: import itertools
  from typing import Callable, Optional, Tuple
  from absl import logging
  import ml_collections
  import tensorflow
  from tensorflow import estimator
  from deepvariant import dv_constants
  from deepvariant import dv_utils
  from deepvariant import keras_modeling
  from deepvariant.protos import deepvariant_pb2
  from google.protobuf import text_format
  from third_party.nucleus.io import sharded_file_utils
label_desc: Use image node_id 1 for calling a global function with example usage: create_parse_example_fn(config) and returns: parse_example, image,  label