code: def artifact_query(
      artifact_type: Type[artifact.Artifact],
      *,
      producer_component_id: Optional[str] = None,
      output_key: Optional[str] = None,
  ) -> channel.Channel:
      """Creates a MLMD query based channel."""
      if output_key is not None and producer_component_id is None:
          raise ValueError(
              "producer_component_id must be set to use output_key."
          )
      return channel.Channel(
          artifact_type,
          producer_component_id=producer_component_id,
          output_key=output_key,
      )
  
imports: import typing
  from typing import Callable, Dict, Iterable, Iterator, List, Optional, Sequence, Set, Type, cast
  from tfx.dsl.placeholder import placeholder
  from tfx.proto.orchestration import placeholder_pb2
  from tfx.types import artifact
  from tfx.types import channel
label_desc: Use image node_id 5 for calling a global function with example usage: artifact_query(artifact_type) and returns: channel