code: def _deserialize_artifact(
      target_type: type[_AT], artifacts: list[_TfxArtifact]
  ) -> list[_AT]:
      """Transforms list[Artifact] into desired tfx artifact class.
  
      This is different from artifact_utils.deserialize_artifacts which depends on
      the globally imported classes to search for the tfx artifact class. The target
      artifact class is explicitly passed, thus it is guaranteed that the artifact
      class is already imported.
  
      Args:
        target_type: TFX artifact type of the result.
        artifacts: Already deserialized artifacts given from ExecutionInfo.
  
      Returns:
        Correctly deserialized artifact list.
      """
      result = []
      for a in artifacts:
          if a.type_name != target_type.TYPE_NAME:
              raise errors.InvalidTypeHintError(
                  f"type_hint uses {target_type.TYPE_NAME} but the resolved artifacts"
                  f" have type_name = {a.type_name}"
              )
          if (
              type(a) is target_type
          ):  # pylint: disable=unidiomatic-typecheck
              result.append(a)
          else:
              new_artifact = target_type()
              new_artifact.set_mlmd_artifact_type(a.artifact_type)
              new_artifact.set_mlmd_artifact(a.mlmd_artifact)
              result.append(new_artifact)
      return result
  
file_path: tfx/tfx/orchestration/portable/execution/di_providers.py
imports: from collections.abc import Container, MutableSequence, Sequence
  import inspect
  from typing import Any, Callable, TypeVar, get_args, get_origin
  from tfx.orchestration.portable import data_types
  from tfx.types import artifact
  from tfx.utils import pure_typing_utils
  from tfx.utils.di import errors
  from tfx.utils.di import providers
label_desc: Use image node_id 3 for calling a global function with example usage: _deserialize_artifact(target_type, artifacts) and returns: result