code: def add(self, interval, offset):
          start, stop = self.get_start_stop(interval)
          if len(self.starts) > 0:
              if start < self.starts[-1] or offset <= self.offsets[-1][1]:
                  raise ValueError('intervals and offsets must be added in-order')
              self.offsets[-1][1] = offset
              self.offsets[-1][2] += 1
          else:
              self.starts.append(start)
              self.stops.append(stop)
              self.offsets.append([offset, offset, 1])