code: def write_event(self, event):
          
          # Check if event is of type event_pb2.Event proto.
          if not isinstance(event, event_pb2.Event):
              raise TypeError("expected an event_pb2.Event proto, "
                              " but got %s" % type(event))
          return self._write_serialized_event(event.SerializeToString())
docs: Appends event to the file.