def http_giveup(exc):
    """
    Inspect a raised exception and determine if we should give up.

    Do not give up when the status code is one of the following:

        429 - Too Many Requests
        502 - Bad Gateway
        503 - Service Unavailable
        504 - Gateway Timeout

    Args:
        exc (aiohttp.ClientResponseException): The exception to inspect

    Returns:
        True if the download should give up, False otherwise
    """
    return exc.code not in [429, 502, 503, 504]
