code: def _load_distributed_snapshot_metadata(
      path: str,
  ) -> Optional[snapshot_pb2.DistributedSnapshotMetadata]:
      """Reads the distributed snapshot metadata.
  
      Args:
        path: Base path of the snapshot.
  
      Returns:
        DistributedSnapshotMetadata if the snapshot is a distributed snapshot.
        Returns None if it is a non-distributed snapshot.
      """
      try:
          with gfile.GFile(
              _pywrap_snapshot_utils.TF_DATA_SnapshotMetadataFilePath(
                  path
              ),
              "r",
          ) as f:
              return text_format.ParseLines(
                  f, snapshot_pb2.DistributedSnapshotMetadata()
              )
      except (
          errors.NotFoundError,
          text_format.ParseError,
          message.DecodeError,
          UnicodeDecodeError,
      ):
          return None
  
imports: import multiprocessing
  import os
  import time
  from typing import Optional
  from google.protobuf import message
  from google.protobuf import text_format
  from tensorflow.core.protobuf import snapshot_pb2
  from tensorflow.python.data.experimental.service import _pywrap_snapshot_utils
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.data.ops import structured_function
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.ops import gen_experimental_dataset_ops
  from tensorflow.python.platform import gfile
  from tensorflow.python.saved_model import nested_structure_coder
label_desc: Use image node_id 2 for calling a global function with example usage: _load_distributed_snapshot_metadata(path) and returns: text_format, None