def getDOMImplementation(name=None, features=()):
 import os
 creator = None
 mod = well_known_implementations.get(name)
 if mod:
  mod = __import__(mod, {}, {}, ['getDOMImplementation'])
  return mod.getDOMImplementation()
 elif name:
  return registered[name]()
 elif ('PYTHON_DOM' in os.environ):
  return getDOMImplementation(name=os.environ['PYTHON_DOM'])
 if isinstance(features, str):
  features = _parse_feature_string(features)
 for creator in registered.values():
  dom = creator()
  if _good_enough(dom, features):
   return dom
 for creator in well_known_implementations.keys():
  try:
   dom = getDOMImplementation(name=creator)
  except Exception:
   continue
  if _good_enough(dom, features):
   return dom
 raise ImportError('no suitable DOM implementation found')

def getDOMImplementation ( name = None , features = ( ) ) : import os creator = None mod = well_known_implementations . get ( name ) if mod : mod = __import__ ( mod , { } , { } , [ 'getDOMImplementation' ] ) return mod . getDOMImplementation ( ) elif name : return registered [ name ] ( ) elif ( 'PYTHON_DOM' in os . environ ) : return getDOMImplementation ( name = os . environ [ 'PYTHON_DOM' ] ) if isinstance ( features , str ) : features = _parse_feature_string ( features ) for creator in registered . values ( ) : dom = creator ( ) if _good_enough ( dom , features ) : return dom for creator in well_known_implementations . keys ( ) : try : dom = getDOMImplementation ( name = creator ) except Exception : continue if _good_enough ( dom , features ) : return dom raise ImportError ( 'no suitable DOM implementation found' )
getdomimplementation(name = none .