<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def discard_bookmark(self, bookmark_to_remove, *, max_retries=3):
 """ Remove a bookmark and check it has been removed. :param bookmark_to_remove: the bookmark to remove :type bookmark_to_remove: a :class:`~bookmark_xso.Bookmark` subclass. :param max_retries: the number of retries of removing the bookmark fails. :type max_retries: :class:`int` :raises RuntimeError: if the bookmark is not removed from bookmark list after `max_retries` retries. If there are multiple occurences of the same bookmark exactly one is removed. This does nothing if the bookmarks does not match an existing bookmark according to bookmark-equality. After setting the bookmark it is checked, whether the bookmark is removed in the online storage, if it is not it is tried again at most `max_retries` times to remove the bookmark. A :class:`RuntimeError` is raised if the bookmark could not be removed successfully after `max_retries`. """

        with (yield from self._lock):
            bookmarks = yield from self._get_bookmarks()
            occurences = bookmarks.count(bookmark_to_remove)

            try:
                if not occurences:
                    return

                modified_bookmarks = list(bookmarks)
                modified_bookmarks.remove(bookmark_to_remove)
                yield from self._set_bookmarks(modified_bookmarks)

                retries = 0
                bookmarks = yield from self._get_bookmarks()
                new_occurences = bookmarks.count(bookmark_to_remove)
                while retries < max_retries:
                    if new_occurences < occurences:
                        break
                    modified_bookmarks = list(bookmarks)
                    modified_bookmarks.remove(bookmark_to_remove)
                    yield from self._set_bookmarks(modified_bookmarks)
                    bookmarks = yield from self._get_bookmarks()
                    new_occurences = bookmarks.count(bookmark_to_remove)
                    retries += 1

                if new_occurences >= occurences:
                    raise RuntimeError("Could not remove bookmark")
            finally:
                self._diff_emit_update(bookmarks)