<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def queue_pop(self, key, **kwargs):
 """ Remove and return the first item queue. :param key: The document ID :param kwargs: Arguments passed to :meth:`mutate_in` :return: A :class:`ValueResult` :raise: :cb_exc:`QueueEmpty` if there are no items in the queue. :raise: :cb_exc:`NotFoundError` if the queue does not exist. """

        while True:
            try:
                itm = self.list_get(key, -1)
            except IndexError:
                raise E.QueueEmpty

            kwargs['cas'] = itm.cas
            try:
                self.list_remove(key, -1, **kwargs)
                return itm
            except E.KeyExistsError:
                pass
            except IndexError:
                raise E.QueueEmpty