def __set_parameter(self, key, value):
        "Takes parameter and attempts to update internal state."
        if key in self.__defaults:
            attr = self.__defaults[key]
            if isinstance(attr, Parameter):
                try:
                    attr.validate(value)
                except (TypeError, ValueError):
                    raise ResourceWarning(repr(key) + ' value failed tests!')
                else:
                    self.__update_change(key, value, attr)
            else:
                raise ResourceWarning(repr(key) + ' is not a Parameter!')
        else:
            self.__changes[key] = Parameter(value)
Takes parameter and attempts to update internal state.
recipes/Python/578173_Settings_Organizer/recipe-578173.py