def is_successful_upgrade(upgrade_response):
    """
    Match against:

        HTTP/1.1 101 Switching Protocols
        Upgrade: websocket
        Connection: Upgrade
        Sec-WebSocket-Accept: HSmrc0sMlYUkAGmm5OPpG2HaGWk=
        Sec-WebSocket-Protocol: chat

    :see: https://en.wikipedia.org/wiki/WebSocket

    :param upgrade_response: The HTTP response
    :return: True if the response is a successful upgrade
    """
    if upgrade_response.get_code() != 101:
        return False

    headers = upgrade_response.get_headers()

    upgrade_value, _ = headers.iget('Upgrade', None)
    connection_value, _ = headers.iget('Connection', None)
    sec_websocket_accept_value, _ = headers.iget('Sec-WebSocket-Accept', None)

    # Relaxed check
    if upgrade_value and connection_value and sec_websocket_accept_value:
        return True

    return False