docs: def write_events(stream, events):
      '''
      Write a sequence of Event protos to file-like object `stream`.
      '''
      for event in events:
          data = event.SerializeToString()
          len_field = struct.pack('<Q', len(data))
          len_crc = struct.pack('<I', masked_crc(len_field))
          data_crc = struct.pack('<I', masked_crc(data))
          stream.write(len_field)
          stream.write(len_crc)
          stream.write(data)
          stream.write(data_crc)