def _all_pages(topfolder):
    """Return list of all page dictionaries in a folder and its sub folders
       Where topfolder is the folder dictionary"""
    # search through folders
    page_list = []
    if "folders" in topfolder:
        for folder in topfolder['folders'].values():
            page_list.extend(_all_pages(folder))
    if "pages" in topfolder:
        for page in topfolder['pages'].values():
            page_list.append(page)
    return page_list