def is_redirect_or_down(endpoint):
    """
    Endpoint is a redirect or down if it is a redirect to an external site or it is down in any of 3 ways:
    it is not live, it is HTTPS and has a bad hostname in the cert, or it responds with a 4xx error code
    """
    return (endpoint.redirect_eventually_to_external or not endpoint.live or
        endpoint.protocol == 'https' and endpoint.https_bad_hostname or 
        endpoint.status is not None and endpoint.status >= 400)
