code: def recover(options):
      
  
      event_format = options.kwargs['omode']
  
      buffer_size = 64*1024
      fpd = open(options.kwargs['output'], "r+")
      fpd.seek(0, 2) # seek to end
      fptr = max(fpd.tell() - buffer_size, 0)
      fptr_eof = 0
  
      while (fptr > 0):
          fpd.seek(fptr)
          event_buffer = fpd.read(buffer_size)
          (event_start, next_event_start, last_time) = \
              get_event_start(event_buffer, event_format)
          if (event_start != -1):
              fptr_eof = event_start + fptr
              break
          fptr = fptr - buffer_size
  
      if fptr < 0:
          # didn't find a valid event, so start over
          fptr_eof = 0
          last_time = 0 
  
      # truncate file here
      fpd.truncate(fptr_eof)
      fpd.seek(fptr_eof)
      fpd.write("\n")
      fpd.close()
  
      return last_time
docs: recover from an existing export run. We do this by
          finding the last time change between events, truncate the file
          and restart from there