code: def _determine_outliers_for_moving_average(moving_average: np.ndarray,
                                             moving_average_threshold: float,
                                             number_of_values_to_search_ahead: int,
                                             limit_of_number_of_values_below_threshold: int) -> int:
      below_threshold = moving_average < moving_average_threshold
      values_to_check = []
      for i in range(limit_of_number_of_values_below_threshold):
          values_to_check.append(
              below_threshold[i:-(limit_of_number_of_values_below_threshold - 1 - i) or None]
          )
      found_at_least_one_bin_above_threshold = False
      cut_index = -1
      for i, values in enumerate(zip(*values_to_check)):
          if i == 0:
              continue
          above_threshold = [not value for value in values]
          if any(above_threshold):
              found_at_least_one_bin_above_threshold = True
          if found_at_least_one_bin_above_threshold and all(np.invert(above_threshold)):
              logger.debug(f"i at found cut_index: {i} with moving_average: {moving_average[i]}")
              cut_index = i + limit_of_number_of_values_below_threshold // 2
              break
      return cut_index