import requests
from typing import Optional


def is_successful_response(response: requests.models.Response) -> bool:
    """
    Checks status code of response for success.

    :param response: The response to check.
    :type response: requests.models.Response
    :return: Was response successful?
    :rtype: bool
    """
    accepted_status_code = str(response.status_code).startswith("2")
    content_type: Optional[str] = response.headers.get("content-type")

    accepted_content_type: bool = False
    if content_type is not None:
        accepted_content_type = content_type.startswith("text/html")
    return accepted_status_code and accepted_content_type