import colorsys


def get_hue(image):
    """Return the most common hue of the image."""
    hues = [0 for x in range(256)]
    # Iterate each pixel. Count each hue value in `hues`.
    for pixel in image.getdata():
        # Ignore greyscale pixels.
        if pixel[0] == pixel[1] and pixel[1] == pixel[2]:
            continue
        # Ignore non-opaque pixels.
        if pixel[3] < 255:
            continue
        h, l, s = colorsys.rgb_to_hls(*[x / 255.0 for x in pixel[:3]])
        # Get a tally of the hue for that image.
        hues[int(h * 255)] += 1

    return hues.index(max(hues))