def _allparts(toplist, part_type):
    """Return list of all part dictionaries within toplist that are of type part_type
       Where toplist is the list of [part_type,part_dict] items as read by read_project()"""
    # search through parts
    part_list = []
    for item in toplist:
        item_type, item_dict = item
        if item_type == part_type:
            part_list.append(item_dict)
            if item_type == 'Widget':
                for key in item_dict.keys():
                    if "container_" in key:
                        part_list.extend(_allparts(item_dict[key], part_type))
        elif item_type == 'Part':
            part_list.extend(_allparts(item_dict['parts'], part_type))
        elif item_type == 'Widget':
            for key in item_dict.keys():
                if "container_" in key:
                    part_list.extend(_allparts(item_dict[key], part_type))
    return part_list