Takes an image url and averages the image.
    Arguments
    url: str
        url for image to average
    name: str
        name to use
    timeout: int
        request timeout in seconds
    max_size: int
        max size of request in MB
    return {red':r_avg, 'green':g_avg, 'blue':b_avg} or None

def average_image_url(url, name, timeout=5, max_size=5):
    """Takes an image url and averages the image.
    Arguments
    url: str
        url for image to average
    name: str
        name to use
    timeout: int
        request timeout in seconds
    max_size: int
        max size of request in MB
    return {red':r_avg, 'green':g_avg, 'blue':b_avg} or None
    """
    try:
        shorturl = url.rsplit('/', 1)[-1]
        logger.debug('Full URL,           %s', url)
        response = requests.get(url, timeout=timeout, stream=True)
        length = int(response.headers.get('Content-Length', 0))
        logger.debug('Request size,       %s - %.2fKB', shorturl, length/1024)
        if length > (1024 * 1024 * max_size):
            raise OversizeException(
                'Response size {2}MB, larger than {0}MB, discarding: {1}'
                .format(max_size, url, math.ceil(length/1024/1024)))
        logger.debug('Finished request,   %s', shorturl)
        result = imagecolor.average(BytesIO(response.content), name=name)
        logger.debug('Averaging complete, %s', shorturl)
        return(result)
    except OversizeException as e:
        logger.warning('Exception: %s', e)
        return(None)
    except Exception as e:
        logger.warning('Exception: %s @ %s', e, url)
        logger.debug('Traceback:', exc_info=True)
        return(None)