code: def accumulate(
      s: "Stream[T]", func: Callable[[T, T], T]
  ) -> "Stream[T]":
      """Creates an accumulation stream.
  
      Parameters
      ----------
      s : `Stream[T]`
          A generic stream.
      func : `Callable[[T, T], T]`
          An accumulator function.
  
      Returns
      -------
      `Stream[T]`
          A accumulated stream of `s`.
      """
      return Accumulator(func)(s).astype(s.dtype)
  
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 5 for calling a global function with example usage: accumulate(s, func) and returns: Accumulator