def image_all_same_colour(image, colour=(255, 255, 255), threshold=0.99):
    """
    Return true if all (or nearly all) pixels are same colour
    """
    num_total = image.size[0] * image.size[1]
    num_different = 0
    pix = image.load()
    for ix in range(image.size[0]):
        for iy in range(image.size[1]):
            if pix[ix, iy] != colour:
                num_different += 1
                if 1.0 - float(num_different / num_total) < threshold:
                    return False
    return True