def validate_url_or_abort(url):
    try:
        urlfile = urlopen(url)
        response_code = urlfile.getcode()
        urlfile.close()
    except IOError:
        response_code = None
    if (not response_code):
        echo_and_log('Did not receive a response from remote machine. Aborting...', LOG_ERR)
        raise click.Abort()
    elif ((response_code / 100) == 4):
        echo_and_log('Image file not found on remote machine. Aborting...', LOG_ERR)
        raise click.Abort()
def validate_url_or_abort(url):
    try:
        urlfile = urlopen(url)
        response_code = urlfile.getcode()
        urlfile.close()
    except IOError:
        response_code = None
    if (not response_code):
        echo_and_log('Did not receive a response from remote machine. Aborting...', LOG_ERR)
        raise click.Abort()
    elif ((response_code / 100) == 4):
        echo_and_log('Image file not found on remote machine. Aborting...', LOG_ERR)
        raise click.Abort()