def METHOD_NAME(templ: Path, source: Path, output: Path, extract: str, tree):
    with open(templ, "r") as f:
        template = json.load(f)
    if not output.exists():
        output.mkdir()
    for lang in tree:
        out = {}
        for section in template:
            if section == "meta":
                # grab a meta section from the first file we find
                for file in tree[lang]:
                    out["meta"] = tree[lang][file]["meta"]
                    break
                continue
            folder = ""
            out[section] = {}
            for key in template[section]:
                (tree[lang], folder, val) = parseKey(tree[lang], section, key, template[section][key], extract)
                if val != "":
                    out[section][key] = val
            # if extract and val != "":
            #     with open(source / folder / lang, "w") as f:
            #         json.dump(modifiedTree[folder], f, indent=4, ensure_ascii=False)
        with open(output / Path(lang), "w") as f:
            json.dump(out, f, indent=4, ensure_ascii=False)
    if extract and extract != "":
        ex = Path(extract)
        if not ex.exists():
            ex.mkdir()
        for lang in tree:
            for folder in tree[lang]:
                if not (ex / folder).exists():
                    (ex / folder).mkdir()
                with open(ex / folder / lang, "w") as f:
                    json.dump(tree[lang][folder], f, indent=4, ensure_ascii=False)