def get_renderer_from_definition(config):
options = config.get('<STR_LIT>', {})<EOL>try:<EOL><INDENT>renderer_type = config['<STR_LIT:type>']<EOL>renderer_colors = [(float(x[<NUM_LIT:0>]), hex_to_color(x[<NUM_LIT:1>])) for x in config['<STR_LIT>']]<EOL>fill_value = options.get('<STR_LIT>')<EOL>if fill_value is not None:<EOL><INDENT>fill_value = float(fill_value)<EOL><DEDENT><DEDENT>except KeyError:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>renderer_kwargs = {<EOL>'<STR_LIT>': renderer_colors,<EOL>'<STR_LIT>': fill_value,<EOL>}<EOL>if renderer_type == "<STR_LIT>":<EOL><INDENT>color_space = options.get('<STR_LIT>', '<STR_LIT>').lower().strip()<EOL>if not color_space in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>raise ValueError("<STR_LIT>".format(color_space))<EOL><DEDENT>renderer = StretchedRenderer(colorspace=color_space, **renderer_kwargs)<EOL><DEDENT>elif renderer_type == "<STR_LIT>":<EOL><INDENT>renderer = ClassifiedRenderer(**renderer_kwargs)<EOL><DEDENT>elif renderer_type == "<STR_LIT>":<EOL><INDENT>try:<EOL><INDENT>labels = [six.text_type(x) for x in options.get('<STR_LIT>', [])]<EOL><DEDENT>except TypeError:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>renderer = UniqueValuesRenderer(labels=labels, **renderer_kwargs)<EOL><DEDENT>return renderer<EOL>
Returns a renderer object based on the configuration (as a dictionary)