code: def get_streak(series, start_index, window):
      r"""Calculate the current streak.
  
      Parameters
      ----------
      series : pandas.Series
          A Boolean series for calculating streaks.
      start_index : int
          The offset of the series to start counting.
      window : int
          The period over which to count.
  
      Returns
      -------
      streak : int
          The count value for the current streak.
  
      """
      if window <= 0:
          window = len(series)
      i = start_index
      streak = 0
      while i >= 0 and (start_index - i + 1) < window and series[i]:
          streak += 1
          i -= 1
      return streak
  
imports: import warnings
  from alphapy.__main__ import main_pipeline
  from alphapy.frame import read_frame
  from alphapy.frame import write_frame
  from alphapy.globals import ModelType
  from alphapy.globals import Partition, datasets
  from alphapy.globals import PSEP, SSEP, USEP
  from alphapy.globals import WILDCARD
  from alphapy.model import get_model_config
  from alphapy.model import Model
  from alphapy.space import Space
  from alphapy.utilities import valid_date
  import argparse
  import datetime
  from itertools import groupby
  import logging
  import math
  import numpy
  import os
  import pandas
  import sys
  import yaml
label_desc: Use image node_id 8 for calling a global function with example usage: get_streak(series, start_index, window) and returns: streak