code: def determine_end_idx_for_adjustment(self,
                                           adjustment_ts,
                                           dates,
                                           upper_bound,
                                           requested_quarter,
                                           sid_estimates):
          
          end_idx = upper_bound
          # Find the next newest kd that happens on or after
          # the date of this adjustment
          newest_kd_for_qtr = sid_estimates[
              (sid_estimates[NORMALIZED_QUARTERS] == requested_quarter) &
              (sid_estimates[TS_FIELD_NAME] >= adjustment_ts)
          ][TS_FIELD_NAME].min()
          if pd.notnull(newest_kd_for_qtr):
              newest_kd_idx = dates.searchsorted(
                  newest_kd_for_qtr
              )
              # We have fresh information that comes in
              # before the end of the overwrite and
              # presumably is already split-adjusted to the
              # current split. We should stop applying the
              # adjustment the day before this new
              # information comes in.
              if newest_kd_idx <= upper_bound:
                  end_idx = newest_kd_idx - 1
          return end_idx
docs: Determines the date until which the adjustment at the given date
          index should be applied for the given quarter.
  
          Parameters
          ----------
          adjustment_ts : pd.Timestamp
              The timestamp at which the adjustment occurs.
          dates : pd.DatetimeIndex
              The calendar dates over which the Pipeline is being computed.
          upper_bound : int
              The index of the upper bound in the calendar dates. This is the
              index until which the adjusment will be applied unless there is
              information for the requested quarter that comes in on or before
              that date.
          requested_quarter : float
              The quarter for which we are determining how the adjustment
              should be applied.
          sid_estimates : pd.DataFrame
              The DataFrame of estimates data for the sid for which we're
              applying the given adjustment.
  
          Returns
          -------
          end_idx : int
              The last index to which the adjustment should be applied for the
              given quarter/sid.