def parse_ipfw_queues():
    result = dict()
    queuetxt = subprocess.run(['/sbin/ipfw', 'queue', 'show'], capture_output=True, text=True).stdout.strip()
    current_queue = None
    current_queue_header = False
    for line in ("%s\nq000000X" % queuetxt).split('\n'):
        if len(line) == 0:
            continue
        if line[0] == 'q':
            m = parse_flowset_params(line)
            if current_queue:
                result[current_queue['flow_set_nr']] = current_queue
            if m:
                current_queue = m.groupdict()
                current_queue['flows'] = list()
        elif line.find('__Source') > 0:
            current_queue_header = True
        else:
            flow_stats = parse_flow(line)
            if flow_stats:
                current_queue['flows'].append(flow_stats)

    return trim_dict(result)