code: def _merge_output_artifact(
      original_artifact: types.Artifact,
      updated_artifact_proto: metadata_store_pb2.Artifact,
  ) -> types.Artifact:
      """Merges an original output artifact with its post-execution updated version.
  
      Args:
        original_artifact: The original Artifact object that was created by the
          Orchestrator and passed to the component in the ExecutionInvocation.
        updated_artifact_proto: The updated Artifact proto returned by the component
          in the ExecutorOutput.
  
      Returns:
        A merged Artifact object combining the original and updated artifacts.
      """
      updated_artifact = types.Artifact(original_artifact.artifact_type)
      updated_artifact.set_mlmd_artifact(updated_artifact_proto)
  
      # Ensure the updated artifact has a consistent ID with the original.
      if original_artifact.mlmd_artifact.HasField("id"):
          updated_artifact_proto.id = original_artifact.mlmd_artifact.id
      else:
          updated_artifact_proto.ClearField("id")
  
      # Ensure the updated artifact has a consistent type ID with the original type.
      if original_artifact.artifact_type.HasField("id"):
          updated_artifact.type_id = original_artifact.artifact_type.id
  
      # Enforce that the component does not update the externality of the artifact.
      updated_artifact.is_external = original_artifact.is_external
  
      return updated_artifact
  
file_path: tfx/tfx/orchestration/portable/merge_utils.py
imports: import copy
  import os
  from typing import Mapping, Optional, Sequence
  from absl import logging
  from tfx import types
  from tfx.orchestration.portable import outputs_utils
  from tfx.utils import typing_utils
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: _merge_output_artifact(original_artifact, updated_artifact_proto) and returns: updated_artifact