def _ensure_html_response(url, session):<EOL>
scheme, netloc, path, query, fragment = urllib_parse.urlsplit(url)<EOL>if scheme not in {'<STR_LIT:http>', '<STR_LIT>'}:<EOL><INDENT>raise _NotHTTP()<EOL><DEDENT>resp = session.head(url, allow_redirects=True)<EOL>resp.raise_for_status()<EOL>_ensure_html_header(resp)<EOL>
Send a HEAD request to the URL, and ensure the response contains HTML.

    Raises `_NotHTTP` if the URL is not available for a HEAD request, or
    `_NotHTML` if the content type is not text/html.