code: def _pick_snapshot_node(
      node_map: Mapping[str, node_proto_view.NodeProtoView],
      nodes_to_run: Set[str],
      nodes_to_reuse: Set[str],
  ) -> Optional[str]:
      """Returns node_id to perform snapshot, or None if snapshot is unnecessary."""
      if not nodes_to_reuse:
          return None
      for node_id in node_map:
          if node_id in nodes_to_run:
              return node_id
      return None
  
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 6 for calling a global function with example usage: _pick_snapshot_node(node_map, nodes_to_run, nodes_to_reuse) and returns: None, None, node_id