code: def register_output_artifacts(
      metadata_handle: metadata.Metadata,
      execution_id: int,
      output_artifacts: typing_utils.ArtifactMultiMap,
  ):
      """Registers REFERENCE and PENDING output artifacts with the execution.
  
      Artifacts in output_artifacts not in state REFERENCE will be given state
      PENDING. Artifacts in state REFERENCE will keep their state.
  
      Each output artifact will be linked to the execution with a PENDING_OUTPUT
      event. The artifacts will be modified in-place to add IDs as registered by
      MLMD.
  
      This function is idempotent if called more than once with the same output
      artifact dict. In that case, the function will find the already registered
      output artifacts for the execution and reuse their IDs. This function cannot,
      however, be called for the same execution more than once with different
      output artifact dicts.
  
      Args:
        metadata_handle: A handle to access MLMD
        execution_id: The ID of an existing execution to apply output artifacts to.
        output_artifacts: The output artifact dict to register. Artifacts will be
          modified in place to add IDs after creation in MLMD.
  
      Raises:
        ValueError if the specified execution is not active, or if this function
        was called once before for the same execution but with a different output
        artifact dict.
      """
      [execution] = metadata_handle.store.get_executions_by_id(
          [execution_id]
      )
      if not is_execution_running(execution):
          raise ValueError(
              "Cannot register output artifacts on inactive "
              f"execution ID={execution_id} with state = "
              f"{execution.last_known_state}"
          )
  
      _register_pending_output_artifacts(
          metadata_handle, execution, output_artifacts
      )
      _register_reference_output_artifacts(
          metadata_handle, execution, output_artifacts
      )
  
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 17 for calling a global function with example usage: register_output_artifacts(metadata_handle, execution_id, output_artifacts) without return types