def importElementTree(module_names=None):
 if (module_names is None):
  module_names = elementtree_modules
 for mod_name in module_names:
  try:
   ElementTree = __import__(mod_name, None, None, ['unused'])
  except ImportError:
   pass
  else:
   try:
    ElementTree.XML('<unused/>')
   except (SystemExit, MemoryError, AssertionError):
    raise
   except:
    why = sys.exc_info()[1]
    log(('Not using ElementTree library %r because it failed to parse a trivial document: %s' % (mod_name, why)))
   else:
    return ElementTree
 else:
  raise ImportError(('No ElementTree library found. You may need to install one. Tried importing %r' % (module_names,)))

def importElementTree ( module_names = None ) : if ( module_names is None ) : module_names = elementtree_modules for mod_name in module_names : try : ElementTree = __import__ ( mod_name , None , None , [ 'unused' ] ) except ImportError : pass else : try : ElementTree . XML ( '<unused/>' ) except ( SystemExit , MemoryError , AssertionError ) : raise except : why = sys . exc_info ( ) [ 1 ] log ( ( 'Not using ElementTree library %r because it failed to parse a trivial document: %s' % ( mod_name , why ) ) ) else : return ElementTree else : raise ImportError ( ( 'No ElementTree library found. You may need to install one. Tried importing %r' % ( module_names , ) ) )
find a working elementtree implementation .