code: def streak(vec):
      r"""Determine the length of the latest streak.
  
      Parameters
      ----------
      vec : pandas.Series
          The input array for calculating the latest streak.
  
      Returns
      -------
      latest_streak : int
          The length of the latest streak.
  
      Example
      -------
  
      >>> vec.rolling(window=20).apply(streak)
  
      """
      latest_streak = [len(list(g)) for k, g in itertools.groupby(vec)][
          -1
      ]
      return latest_streak
  
imports: from alphapy.calendrical import biz_day_month
  from alphapy.calendrical import biz_day_week
  from alphapy.globals import NULLTEXT
  from alphapy.globals import BSEP, PSEP, USEP
  from alphapy.variables import vexec
  import itertools
  import logging
  import math
  import numpy
  import pandas
label_desc: Use image node_id 43 for calling a global function with example usage: streak(vec) and returns: latest_streak