def color_mapper(colors):
        """Map colors according to specified settings.

        Parameters
        ==========

        colors (iterable of colors)
            we iterate over this argument, append each color
            to its corresponding range depending on the
            value of the requested property;

            each color is a sequence of integers in the
            range(256), representing the values of the
            red, green and blue channel of a color;
            a fourth integer may also be present,
            representing the value for the color's alpha
            channel.
        """
        ### create an ordered dict and fill it using names
        ### provided in the range map as the keys and
        ### empty lists as values

        name_to_list = OrderedDict()
        for name in range_map:
            name_to_list[name] = []

        ### iterate over the given colors, appending them to
        ### the appropriate lists depending on the value of
        ### the requested property, that is, depending on
        ### which range they fit

        for rgba_color in colors:

            ### retrieve value of the property (it is in its
            ### unit form here, that is, in the unit interval)
            property_value = property_getter(rgba_color)

            ### iterate over the items from the range map,
            ### until you find the item whose range has the
            ### value we retrieved from the property

            for name, range_obj in range_map.items():
                if property_value in range_obj:
                    break

            ### now that we found the range in which our
            ### property value fits, we append the color
            ### to the list associated with the name of
            ### that range
            name_to_list[name].append(rgba_color)

        ### once finished, return the dictionary we created
        return name_to_list
Map colors according to specified settings.

        Parameters
        ==========

        colors (iterable of colors)
            we iterate over this argument, append each color
            to its corresponding range depending on the
            value of the requested property;

            each color is a sequence of integers in the
            range(256), representing the values of the
            red, green and blue channel of a color;
            a fourth integer may also be present,
            representing the value for the color's alpha
            channel.
        
nodezator/ourstdlibs/color/utils.py