@classmethod
def get_queue(cls, name, priority=0, **fields_if_new):
    """
        Get, or create, and return the wanted queue.
        If the queue is created, fields in fields_if_new will be set for the new
        queue.
        """
    queue_kwargs = {'name': name, 'priority': priority}
    retries = 0
    while retries < 10:
        retries += 1
        try:
            queue, created = cls.get_or_connect(**queue_kwargs)
        except IndexError:
            continue
        except ValueError:
            try:
                queue = cls.collection(**queue_kwargs).instances()[0]
            except IndexError:
                continue
            else:
                created = False
        break
    if created and fields_if_new:
        queue.set_fields(**fields_if_new)
    return queue
