Takes a list of image urls and averages the images to get the
    average color. Designed to be implimented with many methods of
    url sourcing.
    Arguments
    url_list: list
        list of strings with the image urls to average
    max_threads: int
        max number of processes to spawn
    return {red':r_avg, 'green':g_avg, 'blue':b_avg} or None

def _image_search_average(url_list, max_threads=2, **kwargs):
    """Takes a list of image urls and averages the images to get the
    average color. Designed to be implimented with many methods of
    url sourcing.
    Arguments
    url_list: list
        list of strings with the image urls to average
    max_threads: int
        max number of processes to spawn
    return {red':r_avg, 'green':g_avg, 'blue':b_avg} or None
    """
    if len(url_list) < 1:
        raise ZeroResultsException('No urls to average')
    r_total = 0
    g_total = 0
    b_total = 0
    imagecount = 0
    num_results = len(url_list)
    names = [n for n in range(num_results)]
    if num_results <= max_threads:
        threads = num_results
    else:
        threads = max_threads
    with Pool(threads) as p:
        results = p.starmap(partial(
            average_image_url, **kwargs), zip(url_list, names))
    logger.debug('All results averaged')
    for result in results:
        try:
            if result is not None:
                r_total += result['red']
                g_total += result['green']
                b_total += result['blue']
                imagecount += 1
        except TypeError:
            logger.debug('TypeError when iterating over results',
                         exc_info=True)
    logger.debug('Image count %d', imagecount)
    if imagecount > 0:
        logger.debug('Image count greater then 0')
        r_avg = int(r_total / imagecount)
        g_avg = int(g_total / imagecount)
        b_avg = int(b_total / imagecount)
        return({'red': r_avg, 'green': g_avg, 'blue': b_avg})
    else:
        raise ZeroResultsException('Nothing averaged successfully')