code: def queue_pop(self, key, **kwargs):
          
          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
docs: 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.