code: def apply(
      s: "Stream[T]", func: Callable[[T], K], dtype: str = None
  ) -> "Stream[K]":
      """Creates an apply stream.
  
      Parameters
      ----------
      s : `Stream[T]`
          A generic stream.
      func : `Callable[[T], K]`
          A function to be applied to the values of a stream.
      dtype : str, optional
          The data type of the values after function is applied.
  
      Returns
      -------
      `Stream[K]`
          A transformed stream of `s`.
      """
      if dtype is None:
          dtype = s.dtype
      return Apply(func, dtype=dtype)(s)
  
imports: from typing import Callable
  from tensortrade.feed.core.base import Stream, T
  from tensortrade.feed.core.operators import Apply, Lag, Freeze, Accumulator, Copy, TypeVar
label_desc: Use image node_id 1 for calling a global function with example usage: apply(s, func, dtype) and returns: Apply