def tree_to_etree_dom(tree):

    def _set_node_content(node, tree):
        for c in tree["content"]:
            if isinstance(c, dict):
                child = etree.Element(c["tag"], **c.get("attrs", {}))
                _set_node_content(child, c)
                node.append(child)
            else:
                node_children = node.getchildren()
                if len(node_children) == 0:
                    node.text = "%s%s" % (node.text or "", c or "")
                else:
                    node_children[-1].tail = "%s%s" % (node_children[-1].tail or "", c or "")

    dom = etree.Element(tree["tag"], **tree.get("attrs", {}))
    _set_node_content(dom, tree)

    return dom
Verify that all constant definitions evaluate to a value.
dataset/ETHPy150Open Starou/SimpleIDML/src/simple_idml/utils.py/tree_to_etree_dom--crossover with--dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/csparser/checker.py/Checker.check_constants