

def pom_add_element(root, prefix, parent, child, values, comparison_keys, key_order):
    "\n    Checks if an element (spark-package dependency or repository) exists, adds it if it doesn't.\n    'values' is a dictionary. 'comparison_keys' is a list of keys to compare on.\n    "
    dependencies = root.find((prefix + parent))
    if (dependencies is None):
        dependencies = Xml.Element((prefix + parent))
        root.append(dependencies)
    if (not pom_check_if_child_exists(dependencies, prefix, values, comparison_keys)):
        dep = Xml.Element((prefix + child))
        for (key, value) in sorted(values.items(), key=(lambda i: key_order.index(i[0]))):
            pom_add_or_modify_tag(dep, (prefix + key), value)
        dependencies.append(dep)

dataset/ETHPy150Open databricks/spark-package-cmd-tool/python/spark_package/spark_package.py pom_add_element/original