def html_to_xhtml(html):
 try:
  html = html.getroot()
 except AttributeError:
  pass
 prefix = ('{%s}' % XHTML_NAMESPACE)
 for el in html.iter(etree.Element):
  tag = el.tag
  if (tag[0] != '{'):
   el.tag = (prefix + tag)

def html_to_xhtml ( html ) : try : html = html . getroot ( ) except AttributeError : pass prefix = ( '{%s}' % XHTML_NAMESPACE ) for el in html . iter ( etree . Element ) : tag = el . tag if ( tag [ 0 ] != '{' ) : el . tag = ( prefix + tag )
convert all tags in an html tree to xhtml by moving them to the xhtml namespace .