code: def runs(vec):
      r"""Calculate the total number of runs.
  
      Parameters
      ----------
      vec : pandas.Series
          The input array for calculating the number of runs.
  
      Returns
      -------
      runs_value : int
          The total number of runs.
  
      Example
      -------
  
      >>> vec.rolling(window=20).apply(runs)
  
      """
      runs_value = len(list(itertools.groupby(vec)))
      return runs_value
  
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 40 for calling a global function with example usage: runs(vec) and returns: runs_value