def parse_queues_stdout(queues_stdout):
    """
    Retrieve the amount of messages per queues.
    queues_stdout attribute contains the shell output of
    'rabbitmqctl list_queues' command like:

    Listing queues ...
    queuename1     0
    queuename1     4
    ...done.

    The second column contains amount of massages in the queue.
    """
    queues = {}
    for line in queues_stdout.split("\n"):
        line_attrs = line.split()
        if len(line_attrs) == 2:
            queues[line_attrs[0]] = int(line_attrs[1])
    return queues