code: def write_fingerprint(export_dir: str) -> None:
      """Write fingerprint protobuf, if requested.
  
      Writes a `tf.saved_model.experimental.Fingerprint` object to a
      `fingerprint.pb` file in the `export_dir` using the `saved_model.pb` file
      contained in `export_dir`.
  
      Args:
        export_dir: The directory in which to write the fingerprint.
      """
      if flags.config().saved_model_fingerprinting.value():
          fingerprint_path = file_io.join(
              compat.as_str(export_dir),
              compat.as_str(constants.FINGERPRINT_FILENAME),
          )
          logging.info("Writing fingerprint to %s", fingerprint_path)
  
          try:
              fingerprint_serialized = (
                  fingerprinting_pywrap.CreateFingerprintDef(export_dir)
              )
          except FingerprintException as e:
              raise ValueError(e) from None
          file_io.atomic_write_string_to_file(
              fingerprint_path, fingerprint_serialized
          )
  
          metrics.SetWriteFingerprint(
              fingerprint=fingerprint_serialized
          )
          try:
              metrics.SetWritePathAndSingleprint(
                  path=export_dir,
                  singleprint=singleprint_from_fingerprint_proto(
                      export_dir
                  ),
              )
          except metrics.MetricException:
              logging.info(
                  "path_and_singleprint metric could not be set. "
                  "Model saving will continue."
              )
  
file_path: tensorflow-upstream/tensorflow/python/saved_model/fingerprinting_utils.py
imports: from absl import logging
  from tensorflow.core.config import flags
  from tensorflow.core.protobuf import fingerprint_pb2
  from tensorflow.python.lib.io import file_io
  from tensorflow.python.saved_model import fingerprinting
  from tensorflow.python.saved_model.pywrap_saved_model import constants
  from tensorflow.python.saved_model.pywrap_saved_model import fingerprinting
  from tensorflow.python.saved_model.pywrap_saved_model import metrics
  from tensorflow.python.util import compat
label_desc: Use image node_id 1 for calling a global function with example usage: write_fingerprint(export_dir) without return types