#NEWLINE# def get_colors( palette , funcs ) : #NEWLINE# #INDENT# 'Get a dict mapping funcs to colors from palette.\n\n    Parameters\n    ----------\n    palette : string\n        Name of the palette. Must be a key in bokeh.palettes.brewer\n    funcs : iterable\n        Iterable of function names\n    ' #NEWLINE# unique_funcs = list ( sorted ( unique ( funcs ) ) ) #NEWLINE# n_funcs = len ( low ) #NEWLINE# palette_lookup = brewer [ palette ] #NEWLINE# keys = list ( palette_lookup . keys ( ) ) #NEWLINE# ( low , high ) = ( min ( keys ) , max ( keys ) ) #NEWLINE# if ( n_funcs > high ) : #NEWLINE# #INDENT# colors = cycle ( palette_lookup [ high ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( n_funcs < low ) : #NEWLINE# #INDENT# colors = palette_lookup [ low ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# colors = palette_lookup [ n_funcs ] #NEWLINE# #UNINDENT# #UNINDENT# color_lookup = dict ( zip ( unique_funcs , colors ) ) #NEWLINE# return [ color_lookup [ n ] for n in funcs ]