docs: def channel(val: Any,
              default: Any = RaiseTypeErrorIfNotProvided
              ) -> Union[Tuple[np.ndarray], Sequence[TDefault]]:
      r"""Returns a list of matrices describing the channel for the given value.
  
      These matrices are the terms in the operator sum representation of
      a quantum channel. If the returned matrices are {A_0,A_1,..., A_{r-1}},
      then this describes the channel:
          \rho \rightarrow \sum_{k=0}^{r-1} A_0 \rho A_0^\dagger
      These matrices are required to satisfy the trace preserving condition
          \sum_{k=0}^{r-1} A_i^\dagger A_i = I
      where I is the identity matrix. The matrices A_i are sometimes called
      Krauss or noise operators.
  
      Args:
          val: The value to describe by a channel.
          default: Determines the fallback behavior when `val` doesn't have
              a channel. If `default` is not set, a TypeError is raised. If
              default is set to a value, that value is returned.
  
      Returns:
          If `val` has a `_channel_` method and its result is not NotImplemented,
          that result is returned. Otherwise, if `val` has a `_mixture_` method
          and its results is not NotImplement a tuple made up of channel
          corresponding to that mixture being a probabilistic mixture of unitaries
          is returned.  Otherwise, if `val` has a `_unitary_` method and
          its result is not NotImplemented a tuple made up of that result is
          returned. Otherwise, if a default value was specified, the default
          value is returned.
  
      Raises:
          TypeError: `val` doesn't have a _channel_ or _unitary_ method (or that
              method returned NotImplemented) and also no default value was
              specified.
      """
      channel_getter = getattr(val, '_channel_', None)
      channel_result = (
          NotImplemented if channel_getter is None else channel_getter())
      if channel_result is not NotImplemented:
          return tuple(channel_result)
  
      mixture_getter = getattr(val, '_mixture_', None)
      mixture_result = (
          NotImplemented if mixture_getter is None else mixture_getter())
      if mixture_result is not NotImplemented:
          return tuple(np.sqrt(p) * u for p, u in mixture_result)
  
      unitary_getter = getattr(val, '_unitary_', None)
      unitary_result = (
          NotImplemented if unitary_getter is None else unitary_getter())
      if unitary_result is not NotImplemented:
          return (unitary_result,)
  
      if default is not RaiseTypeErrorIfNotProvided:
          return default
  
      if (channel_getter is None and unitary_getter is None
              and mixture_getter is None):
          raise TypeError("object of type '{}' has no _channel_ or _mixture_ or "
                          "_unitary_ method.".format(type(val)))
      raise TypeError("object of type '{}' does have a _channel_, _mixture_ or "
                  "_unitary_ method, but it returned NotImplemented."
                  .format(type(val)))