code: def _validate_updated_artifact(
      updated_artifact: metadata_store_pb2.Artifact,
      original_artifact: types.Artifact,
      has_multiple_artifacts: bool,
  ) -> None:
      """Check the validity of an updated artifact against the original artifact."""
      if (
          original_artifact.mlmd_artifact.HasField("type_id")
          and updated_artifact.HasField("type_id")
          and updated_artifact.type_id != original_artifact.type_id
      ):
          raise RuntimeError(
              "Executor output should not change artifact type "
              f"(original type_id={original_artifact.type_id}, "
              f"new type_id={updated_artifact.type_id})."
          )
  
      # If the artifact is external and the uri is resolved during runtime, it
      # doesn't check the validity of uri.
      if (
          original_artifact.is_external
          and original_artifact.uri == _RESOLVED_AT_RUNTIME
      ):
          return
  
      if has_multiple_artifacts:
          # If there are multiple artifacts in the executor output, their URIs should
          # be a direct sub-dir of the system generated URI.
          if (
              os.path.dirname(updated_artifact.uri)
              != original_artifact.uri
          ):
              raise RuntimeError(
                  "When there are multiple artifacts to publish, their URIs "
                  "should be direct sub-directories of the URI of the system generated "
                  "artifact."
              )
      else:
          # If there is only one output artifact, its URI should not be changed
          if updated_artifact.uri != original_artifact.uri:
              # TODO(b/175426744): Data Binder will modify the uri.
              logging.warning(
                  "When there is one artifact to publish, the URI of it should be "
                  "identical to the URI of system generated 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 2 for calling a global function with example usage: _validate_updated_artifact(updated_artifact, original_artifact, has_multiple_artifacts) without return types