+class WLElementLookup(etree.CustomElementClassLookup):
+ def lookup(self, node_type, document, namespace, name):
+ if node_type != 'element':
+ return
+ if namespace:
+ return
+ try:
+ return WL_ELEMENTS[name]
+ except KeyError:
+ return
+
+
+parser = etree.XMLParser()
+parser.set_element_class_lookup(
+ WLElementLookup()
+)