code: def _despike(series, n1, n2, block, keep):
      
  
      data = series.values.astype(float).copy()
      roll = _rolling_window(data, block)
      roll = ma.masked_invalid(roll)
      std = n1 * roll.std(axis=1)
      mean = roll.mean(axis=1)
      # Use the last value to fill-up.
      std = np.r_[std, np.tile(std[-1], block - 1)]
      mean = np.r_[mean, np.tile(mean[-1], block - 1)]
      mask = np.abs(data - mean.filled(fill_value=np.NaN)) > std.filled(
          fill_value=np.NaN
      )
      data[mask] = np.NaN
  
      # Pass two recompute the mean and std without the flagged values from pass
      # one and removed the flagged data.
      roll = _rolling_window(data, block)
      roll = ma.masked_invalid(roll)
      std = n2 * roll.std(axis=1)
      mean = roll.mean(axis=1)
      # Use the last value to fill-up.
      std = np.r_[std, np.tile(std[-1], block - 1)]
      mean = np.r_[mean, np.tile(mean[-1], block - 1)]
      values = series.values.astype(float)
      mask = np.abs(values - mean.filled(fill_value=np.NaN)) > std.filled(
          fill_value=np.NaN
      )
  
      clean = series.astype(float).copy()
      clean[mask] = np.NaN
      return clean
docs: Wild Edit Seabird-like function.  Passes with Standard deviation
      `n1` and `n2` with window size `block`.