def create_class_from_element_tree(target_class, tree, namespace=None, tag=None):
 if (namespace is None):
  namespace = target_class.c_namespace
 if (tag is None):
  tag = target_class.c_tag
 if (tree.tag == ('{%s}%s' % (namespace, tag))):
  target = target_class()
  target.harvest_element_tree(tree)
  return target
 else:
  return None

def create_class_from_element_tree ( target_class , tree , namespace = None , tag = None ) : if ( namespace is None ) : namespace = target_class . c_namespace if ( tag is None ) : tag = target_class . c_tag if ( tree . tag == ( '{%s}%s' % ( namespace , tag ) ) ) : target = target_class ( ) target . harvest_element_tree ( tree ) return target else : return None
instantiates the class and populates members according to the tree .