def extract_top_dicts_subento(d):
    misc = {"subento": [], "hook_files": []}

    if "libraries" in d:
        libraries = d.pop("libraries")
    else:
        libraries = {}
    # FIXME: bento vs subento visitor. Those should not be defined in the first
    # place for subento.
    for library in libraries.values():
        for k, field_name in [("install_requires", "InstallRequires"), ("py_modules", "Modules")]:
            v = library.pop(k)
            if len(v) > 0:
                raise InvalidPackage("Invalid entry %r in recursed bento file(s)" % field_name)
    for k in misc.keys():
        if k in d:
            misc[k] = d.pop(k)

    # FIXME: bento vs subento visitor. Those should not be defined in the first
    # place for subento.
    for k in ["path_options", "flag_options", "data_files", "extra_source_files", "executables"]:
        v = d.pop(k)
        if len(v) > 0:
            raise ValueError("Invalid non empty entry %s" % k)
    if len(d) > 0:
        raise ValueError("Unknown entry(ies) %s" % d.keys())

    return libraries, misc
Given an "abstract" dictionary returned by parse_to_dict, build
dataset/ETHPy150Open cournape/Bento/bento/core/parse_helpers.py/extract_top_dicts_subento