def color_list_prepare_mode(self):
        """Setups to execute before starting the mode."""
        ### check the existence of a 'color_list_colors'
        ### attribute
        try:
            self.color_list_colors

        ### if such attribute doesn't exist, execute a
        ### method to create such list and the related
        ### color widgets
        except AttributeError:
            self.create_color_list()

        ### the same method should be used in case the
        ### attribute exists but it is different from the
        ### value in the 'colors' attribute, in which case
        ### the 'colors' is assigned to 'color_list_colors'
        ### and related color widgets are recreated

        else:

            if self.colors != self.color_list_colors:
                self.create_color_list()
Setups to execute before starting the mode.
nodezator/colorsman/viewer/modes/colorlist.py