code: def _ensure_html_header(response):
      # type: (Response) -> None
      
      content_type = response.headers.get("Content-Type", "")
      if not content_type.lower().startswith("text/html"):
          raise _NotHTML(content_type, response.request.method)
docs: Check the Content-Type header to ensure the response contains HTML.
  
      Raises `_NotHTML` if the content type is not text/html.