def _ensure_html_header(response):
    'Check the Content-Type header to ensure the response contains HTML.\n\n    Raises `_NotHTML` if the content type is not text/html.\n    '
    content_type = response.headers.get('Content-Type', '')
    if (not content_type.lower().startswith('text/html')):
        raise _NotHTML(content_type, response.request.method)
Check the Content-Type header to ensure the response contains HTML.

Raises `_NotHTML` if the content type is not text/html.
def _ensure_html_header(response):
    'Check the Content-Type header to ensure the response contains HTML.\n\n    Raises `_NotHTML` if the content type is not text/html.\n    '
    content_type = response.headers.get('Content-Type', )
    if (not content_type.lower().startswith('text/html')):
        raise _NotHTML(content_type, response.request.method)