def list_messages(base, queue_name):
    """Utility function that lists messages in Zaqar queue."""
    res = base.messaging_client.list_messages(queue_name)

    if res['status'] != 200:
        msg = 'Failed in listing messsages for Zaqar queue %s' % queue_name
        raise Exception(msg)

    return res['body']['messages']