code: def _contiguous_offsets(self, offsets):
          offsets.sort()
          for i in range(len(offsets) - 1):
              assert offsets[i] + 1 == offsets[i + 1], \
                  "Offsets not contiguous: %s" % (offsets,)
          return offsets