def METHOD_NAME(self, root_uid: str | None, uid: str, whitelist: list[str]) -> FileTreeNode:
    if root_uid is None:
        # parent FW set should never be empty (if it were empty, the file would not belong to any FW)
        root_uid = list(self.db.frontend.get_parent_fw(uid)).pop()
    root = FileTreeNode(None)
    with get_shared_session(self.db.frontend) as frontend_db:
        child_uids = [
            child_uid
            for child_uid in frontend_db.get_object(uid).files_included
            if whitelist is None or child_uid in whitelist
        ]
        for node in frontend_db.generate_file_tree_nodes_for_uid_list(child_uids, root_uid, uid, whitelist):
            root.add_child_node(node)
    return root