def Close(self):
    if not self.dirty: return
    storage = aff4.FACTORY.Create(self.urn.Add("Storage"), "AFF4Image",
                                  token=self.token)
    storage.SetChunksize(1024 * 1024)

    if self.heap:
      first = last = self.heap[0][0]
      # Note our first event and size
      self.Set(self.Schema.SIZE(len(self.heap)))
      self.Set(self.Schema.START(first))

      while self.heap:
        # This pulls the smallest time from the heap
        last, serialized_event = heapq.heappop(self.heap)

        # Write the length and then the data
        storage.Write(struct.pack("<i", len(serialized_event)))
        storage.Write(serialized_event)

      # Note our last event and size
      self.Set(self.Schema.END(last))

      # We are done - flush and close the file.
      storage.Close()

    self.Set(self.Schema.SIZE(self.size))
    super(GRRTimeSeries, self).Close()
This is mainly helpful for debugging purposes
dataset/ETHPy150Open google/grr/grr/lib/aff4_objects/timeline.py/GRRTimeSeries.Close--crossover with--dataset/ETHPy150Open dokterbob/satchmo/satchmo/apps/shipping/modules/ups/shipper.py/Shipper.__str__