def import_coordinator_root(coordinator, coordinator_definition_root, metadata=None):
  xslt_definition_fh = open("%(xslt_dir)s/coordinator.xslt" % {
    'xslt_dir': os.path.join(conf.DEFINITION_XSLT_DIR.get(), 'coordinators')
  })

  tag = etree.QName(coordinator_definition_root.tag)
  schema_version = tag.namespace

  # Ensure namespace exists
  if schema_version not in OOZIE_NAMESPACES:
    raise RuntimeError(_("Tag with namespace %(namespace)s is not valid. Please use one of the following namespaces: %(namespaces)s") % {
      'namespace': coordinator_definition_root.tag,
      'namespaces': ', '.join(OOZIE_NAMESPACES)
    })

  # Get XSLT and Transform XML
  xslt = etree.parse(xslt_definition_fh)
  xslt_definition_fh.close()
  transform = etree.XSLT(xslt)
  transformed_root = transform(coordinator_definition_root)

  # Deserialize XML
  objects = serializers.deserialize('xml', etree.tostring(transformed_root))
  # Resolve coordinator dependencies and node types and link dependencies
  _set_coordinator_properties(coordinator, coordinator_definition_root, schema_version)
  _set_controls(coordinator, coordinator_definition_root, schema_version)
  _reconcile_datasets(coordinator, objects, coordinator_definition_root, schema_version)
  _set_properties(coordinator, coordinator_definition_root, schema_version)
  if metadata:
    _process_metadata(coordinator, metadata)

  # Update schema_version
  coordinator.schema_version = schema_version
  coordinator.save()
dataset/ETHPy150Open cloudera/hue/apps/oozie/src/oozie/importlib/coordinators.py/import_coordinator_root/original