code: def snapshot(
      mlmd_handle: metadata.Metadata,
      pipeline: pipeline_pb2.Pipeline,
      base_run_id: Optional[str] = None,
  ) -> None:
      """Performs a snapshot.
  
      This operation modifies the MLMD state, so that the dependencies of
      a partial run can be resolved as if the reused artifacts were produced in the
      same pipeline run.
  
      Args:
        mlmd_handle: A handle to the MLMD db.
        pipeline: The marked pipeline IR.
        base_run_id: The base pipeline run ID to reuse artifacts from.
  
      Raises:
        ValueError: If pipeline_node has a snashot_settings field set, but the
          artifact_reuse_strategy field is not set in it.
      """
      # Avoid unnecessary snapshotting step if no node needs to reuse any artifacts.
      if not any(
          _should_attempt_to_reuse_artifact(
              node.pipeline_node.execution_options
          )
          for node in pipeline.nodes
      ):
          return
  
      snapshot_settings = pipeline.runtime_spec.snapshot_settings
      logging.info("snapshot_settings: %s", snapshot_settings)
      if not base_run_id:
          if snapshot_settings.HasField("base_pipeline_run_strategy"):
              base_run_id = (
                  snapshot_settings.base_pipeline_run_strategy.base_run_id
              )
              logging.info(
                  "Using base_pipeline_run_strategy with base_run_id=%s",
                  base_run_id,
              )
          elif snapshot_settings.HasField(
              "latest_pipeline_run_strategy"
          ):
              logging.info("Using latest_pipeline_run_strategy.")
          else:
              raise ValueError(
                  "artifact_reuse_strategy not set in SnapshotSettings."
              )
      logging.info("Preparing to reuse artifacts.")
      _reuse_pipeline_run_artifacts(
          mlmd_handle, pipeline, base_run_id=base_run_id
      )
      logging.info("Artifact reuse complete.")
  
imports: import collections
  import concurrent.futures
  import enum
  from typing import Collection, Dict, Final, List, Mapping, Optional, OrderedDict, Sequence, Set, Tuple
  import uuid
  from absl import logging
  from tfx.dsl.compiler import compiler_utils
  from tfx.dsl.compiler import constants
  from tfx.orchestration import metadata
  from tfx.orchestration import node_proto_view
  from tfx.orchestration.portable import execution_publish_utils
  from tfx.orchestration.portable.mlmd import context_lib
  from tfx.orchestration.portable.mlmd import execution_lib
  from tfx.proto.orchestration import pipeline_pb2
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 5 for calling a global function with example usage: snapshot(mlmd_handle, pipeline, base_run_id) without return types