code: def unwrap_simple_channel_placeholder(
      placeholder: ph.Placeholder,
  ) -> channel.Channel:
      """Unwraps a `x.future()[0].value` placeholder and returns its `x`.
  
      Args:
        placeholder: A placeholder expression.
  
      Returns:
        The (only) channel involved in the expression.
  
      Raises:
        ValueError: If the input placeholder is anything more complex than
          `some_channel.future()[0].value`, and in particular if it involves
          multiple channels, arithmetic operations or input/output artifacts.
      """
      # Validate that it's the right shape.
      outer_ph = placeholder.encode()
      index_op = (
          outer_ph.operator.artifact_value_op.expression.operator.index_op
      )
      cwp = index_op.expression.placeholder
      if (
          # This catches the case where we've been navigating down non-existent
          # proto paths above and been getting default messages all along. If this
          # sub-message is present, then the whole chain was correct.
          not index_op.expression.HasField("placeholder")
          # ChannelWrappedPlaceholder uses INPUT_ARTIFACT for some reason, and has
          # no key when encoded with encode().
          or cwp.type != placeholder_pb2.Placeholder.Type.INPUT_ARTIFACT
          or cwp.key
          # For the `[0]` part of the desired shape.
          or index_op.index != 0
      ):
          raise ValueError(
              "Expected placeholder of shape somechannel.future()[0].value, but got"
              f" {placeholder}."
          )
  
      # Now that we know there's only one channel inside, we can just extract it:
      return next(
          p.channel
          for p in placeholder.traverse()
          if isinstance(p, ph.ChannelWrappedPlaceholder)
      )
  
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 8 for calling a global function with example usage: unwrap_simple_channel_placeholder(placeholder) and returns: next