def document_fromstring(html, guess_charset=True, parser=None):
 if (not isinstance(html, _strings)):
  raise TypeError('string required')
 if (parser is None):
  parser = html_parser
 return parser.parse(html, useChardet=guess_charset).getroot()

def document_fromstring ( html , guess_charset = True , parser = None ) : if ( not isinstance ( html , _strings ) ) : raise TypeError ( 'string required' ) if ( parser is None ) : parser = html_parser return parser . parse ( html , useChardet = guess_charset ) . getroot ( )
parse a whole document into a string .