code: def _write_metadata(
      model_path: str,
      label_map_path: str,
      mean: List[float],
      std: List[float],
  ):
      """Add normalization option and label map TFLite metadata to the model.
  
      Args:
        model_path: The path of the TFLite model
        label_map_path: The path of the label map file
        mean: The mean value used to normalize input image tensor
        std: The standard deviation used to normalize input image tensor
      """
  
      # Creates flatbuffer for model information.
      model_meta = _metadata_fb.ModelMetadataT()
  
      # Creates flatbuffer for model input metadata.
      # Here we add the input normalization info to input metadata.
      input_meta = _metadata_fb.TensorMetadataT()
      input_normalization = _metadata_fb.ProcessUnitT()
      input_normalization.optionsType = (
          _metadata_fb.ProcessUnitOptions.NormalizationOptions
      )
      input_normalization.options = _metadata_fb.NormalizationOptionsT()
      input_normalization.options.mean = mean
      input_normalization.options.std = std
      input_meta.processUnits = [input_normalization]
  
      # Creates flatbuffer for model output metadata.
      # Here we add label file to output metadata.
      output_meta = _metadata_fb.TensorMetadataT()
      label_file = _metadata_fb.AssociatedFileT()
      label_file.name = os.path.basename(label_map_path)
      label_file.type = (
          _metadata_fb.AssociatedFileType.TENSOR_AXIS_LABELS
      )
      output_meta.associatedFiles = [label_file]
  
      # Creates subgraph to contain input and output information,
      # and add subgraph to the model information.
      subgraph = _metadata_fb.SubGraphMetadataT()
      subgraph.inputTensorMetadata = [input_meta]
      subgraph.outputTensorMetadata = [output_meta]
      model_meta.subgraphMetadata = [subgraph]
  
      # Serialize the model metadata buffer we created above using flatbuffer
      # builder.
      b = flatbuffers.Builder(0)
      b.Finish(
          model_meta.Pack(b),
          _metadata.MetadataPopulator.METADATA_FILE_IDENTIFIER,
      )
      metadata_buf = b.Output()
  
      # Populates metadata and label file to the model file.
      populator = _metadata.MetadataPopulator.with_model_file(
          model_path
      )
      populator.load_metadata_buffer(metadata_buf)
      populator.load_associated_files([label_map_path])
      populator.populate()
  
imports: import os
  from typing import List
  import absl
  import flatbuffers
  import tensorflow
  import tensorflow_transform
  from tfx.components.trainer.fn_args_utils import DataAccessor
  from tfx.components.trainer.fn_args_utils import FnArgs
  from tfx.components.trainer.rewriting import converters
  from tfx.components.trainer.rewriting import rewriter
  from tfx.components.trainer.rewriting import rewriter_factory
  from tfx.dsl.io import fileio
  from tfx_bsl.tfxio import dataset_options
  from tflite_support import metadata_schema_py_generated
  from tflite_support import metadata
label_desc: Use image node_id 9 for calling a global function with example usage: _write_metadata(model_path, label_map_path, mean, std) without return types