def invert_cmap(pix, l, colors):
    kd = cKDTree(colors)
    ni, nj, nc = pix.shape
    pix = pix.reshape((ni * nj, nc))
    d, i = kd.query(pix)
    i = i.reshape((ni, nj))
    return l[i]
Dumps a python data structure to a saved on-disk representation.  We
dataset/ETHPy150Open mrterry/yoink/yoink/interp.py/invert_cmap--crossover with--dataset/ETHPy150Open NervanaSystems/neon/neon/util/persist.py/save_obj