code: def barssince(condition: Sequence[bool], default=np.inf) -> int:
      """
      Return the number of bars since `condition` sequence was last `True`,
      or if never, return `default`.
  
          >>> barssince(self.data.Close > self.data.Open)
          3
      """
      return next(
          compress(range(len(condition)), reversed(condition)), default
      )
  
imports: from collections import OrderedDict
  from inspect import currentframe
  from itertools import compress
  from numbers import Number
  from typing import Callable, Optional, Sequence, Union
  import numpy
  import pandas
  from ._plotting import plot_heatmaps
  from ._stats import compute_stats
  from ._util import _Array, _as_str
  from .backtesting import Strategy
label_desc: Use image node_id 1 for calling a global function with example usage: barssince(condition, default) and returns: next