#NEWLINE# def rgb2short( r , g , b ) : #NEWLINE# #INDENT# '\n    RGB to short\n    ' #NEWLINE# dist = ( lambda s , d : ( ( ( ( s [ 0 ] - d [ 0 ] ) ** 2 ) + ( ( s [ 1 ] - d [ 1 ] ) ** 2 ) ) + ( ( s [ 2 ] - d [ 2 ] ) ** 2 ) ) ) #NEWLINE# ary = [ hex_to_rgb ( hex ) for hex in RGB2SHORT_DICT ] #NEWLINE# m = min ( ary , key = partial ( dist , ( r , g , b ) ) ) #NEWLINE# return RGB2SHORT_DICT [ rgb_to_hex ( m ) ]