code: def put_execution(
      metadata_handle: metadata.Metadata,
      execution: metadata_store_pb2.Execution,
      contexts: Sequence[metadata_store_pb2.Context],
      input_artifacts: Optional[typing_utils.ArtifactMultiMap] = None,
      output_artifacts: Optional[typing_utils.ArtifactMultiMap] = None,
      input_event_type: metadata_store_pb2.Event.Type = metadata_store_pb2.Event.INPUT,
      output_event_type: metadata_store_pb2.Event.Type = metadata_store_pb2.Event.OUTPUT,
  ) -> metadata_store_pb2.Execution:
      """Writes an execution-centric subgraph to MLMD.
  
      This function mainly leverages metadata.put_execution() method to write the
      execution centric subgraph to MLMD.
  
      Args:
        metadata_handle: A handler to access MLMD.
        execution: The execution to be written to MLMD.
        contexts: MLMD contexts to associated with the execution.
        input_artifacts: Input artifacts of the execution. Each artifact will be
          linked with the execution through an event with type input_event_type.
          Each artifact will also be linked with every context in the `contexts`
          argument.
        output_artifacts: Output artifacts of the execution. Each artifact will be
          linked with the execution through an event with type output_event_type.
          Each artifact will also be linked with every context in the `contexts`
          argument.
        input_event_type: The type of the input event, default to be INPUT.
        output_event_type: The type of the output event, default to be OUTPUT.
  
      Returns:
        An MLMD execution that is written to MLMD, with id populated.
      """
      artifact_and_events = []
      if input_artifacts:
          artifact_and_events.extend(
              _create_artifact_and_event_pairs(
                  metadata_handle=metadata_handle,
                  artifact_dict=input_artifacts,
                  event_type=input_event_type,
              )
          )
      if output_artifacts:
          outputs_utils.tag_output_artifacts_with_version(
              output_artifacts
          )
          artifact_and_events.extend(
              _create_artifact_and_event_pairs(
                  metadata_handle=metadata_handle,
                  artifact_dict=output_artifacts,
                  event_type=output_event_type,
              )
          )
      (
          execution_id,
          artifact_ids,
          contexts_ids,
      ) = metadata_handle.store.put_execution(
          execution=execution,
          artifact_and_events=artifact_and_events,
          contexts=contexts,
          reuse_context_if_already_exist=True,
          reuse_artifact_if_already_exist_by_external_id=True,
          force_reuse_context=True,
      )
      execution.id = execution_id
      for artifact_and_event, a_id in zip(
          artifact_and_events, artifact_ids
      ):
          artifact, _ = artifact_and_event
          artifact.id = a_id
      for context, c_id in zip(contexts, contexts_ids):
          context.id = c_id
  
      return execution
  
imports: from __future__ import annotations
  import collections
  import copy
  import itertools
  import re
  from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple
  from absl import logging
  from tfx import types
  from tfx.orchestration import data_types_utils
  from tfx.orchestration import metadata
  from tfx.orchestration.portable import outputs_utils
  from tfx.orchestration.portable.mlmd import artifact_lib
  from tfx.orchestration.portable.mlmd import common_utils
  from tfx.orchestration.portable.mlmd import event_lib
  from tfx.orchestration.portable.mlmd import filter_query_builder
  from tfx.utils import metrics_utils
  from tfx.proto.orchestration import execution_result_pb2
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.utils import proto_utils
  from tfx.utils import typing_utils
  from tfx.utils import telemetry_utils
  from google.protobuf import json_format
  import ml_metadata
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 14 for calling a global function with example usage: put_execution(metadata_handle, execution, contexts, input_artifacts, output_artifacts, input_event_type, output_event_type) and returns: execution