def quantize(self, image):
        """ Use a kdtree to quickly find the closest palette colors for the pixels """
        if get_cKDTree():
            return self.quantize_with_scipy(image)
        else:
            print('Scipy not available, falling back to slower version.')
            return self.quantize_without_scipy(image)
def quantize ( self , image ) : if get_cKDTree ( ) : return self . quantize_with_scipy ( image ) else : print ( 'Scipy not available, falling back to slower version.' ) return self . quantize_without_scipy ( image )
Use a kdtree to quickly find the closest palette colors for the pixels