code: def clipping_threshold(ts, capacity=100, rate_limit=10):
      
      params = clipping_params(ts, capacity=capacity, rate_limit=rate_limit)
      if params:
          return params['threshold']
      return None
docs: Start and end index (datetime) that clips the price/value of a time series the most
  
      Assumes that the integrated maximum includes the peak (instantaneous maximum).
  
      Arguments:
        ts (TimeSeries): Time series of prices or power readings to be "clipped" as much as possible.
        capacity (float): Total "funds" or "energy" available for clipping (in $ or Joules)
          The maximum allowed integrated area under time series and above the clipping threshold.
        rate_limit: Maximum rate at which funds or energy can be expended (in $/s or Watts)
          The clipping threshold is limitted to no less than the peak power (price rate) minus this rate_limit
  
      Returns:
        dict: Timestamp of the start and end of the period of the maximum clipped integrated increase
  
      >>> t = ['2014-12-09T00:00', '2014-12-09T00:15', '2014-12-09T00:30', '2014-12-09T00:45',
      ...      '2014-12-09T01:00', '2014-12-09T01:15', '2014-12-09T01:30', '2014-12-09T01:45']
      >>> import pandas as pd
      >>> ts = pd.Series([217, 234, 235, 231, 219, 219, 231, 232], index=pd.to_datetime(t))
      >>> clipping_threshold(ts, capacity=60000)  # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS
      218.13...
      >>> clipping_threshold(ts, capacity=30000)  # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS
      224.15...