def toggle_tags(self, querystring, tags, afterwards=None):
        """
        toggles tags from messages that match `querystring`.
        This appends a toggle operation to the write queue and raises
        :exc:`~errors.DatabaseROError` if in read only mode.