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