code: def compact(self):
          
          previous_value = object()
          redundant = []
          for time, value in self:
              if value == previous_value:
                  redundant.append(time)
              previous_value = value
          for time in redundant:
              del self[time]
docs: Convert this instance to a compact version: the value will be the
          same at all times, but repeated measurements are discarded.