def write_batch(self, batch):
        """
        Buffer a batch of items to be written and update internal counters.

        Calling this method doesn't guarantee that all items have been written.
        To ensure everything has been written you need to call flush().
        """
        for item in batch:
            self.write_buffer.buffer(item)
            key = self.write_buffer.get_key_from_item(item)
            if self.write_buffer.should_write_buffer(key):
                self._write_current_buffer_for_group_key(key)
            self.increment_written_items()
            self._check_items_limit()
Buffer a batch of items to be written and update internal counters.

        Calling this method doesn't guarantee that all items have been written.
        To ensure everything has been written you need to call flush().