def rgb2short(r, g, b):
    dist = lambda s, d: (s[0] - d[0]) ** 2 + \
        (s[1] - d[1]) ** 2 + (s[2] - d[2]) ** 2
    ary = [hex_to_rgb(hex) for hex in RGB2SHORT_DICT]
    m = min(ary, key=partial(dist, (r, g, b)))
    return RGB2SHORT_DICT[rgb_to_hex(m)]
Converts a Task payload into UTF-8 and sets headers if necessary.
dataset/ETHPy150Open DTVD/rainbowstream/rainbowstream/pure_image.py/rgb2short--crossover with--dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/api/taskqueue/taskqueue.py/Task.__convert_payload