code: def as_channel(
      artifacts: Iterable[artifact.Artifact],
  ) -> channel.Channel:
      """Converts artifact collection of the same artifact type into a Channel.
  
      Args:
        artifacts: An iterable of Artifact.
  
      Returns:
        A static Channel containing the source artifact collection.
  
      Raises:
        ValueError when source is not a non-empty iterable of Artifact.
      """
      try:
          first_element = next(iter(artifacts))
          if isinstance(first_element, artifact.Artifact):
              return channel.Channel(
                  type=first_element.type
              ).set_artifacts(artifacts)
          else:
              raise ValueError(
                  "Invalid artifact iterable: {}".format(artifacts)
              )
      except StopIteration as e:
          raise ValueError(
              "Cannot convert empty artifact iterable into Channel"
          ) from e
  
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 1 for calling a global function with example usage: as_channel(artifacts) and returns: channel