      def validate_config(self):
          """ Check for options in default config against saved config
              and add/remove as appropriate """
          logger.debug("Validating config")
          if self.check_config_change():
              self.add_new_config_items()
          self.check_config_choices()
          logger.debug("Validated config")
  
      def add_new_config_items(self):
          """ Add new items to the config file """
          logger.debug("Updating config")
 
</s> remove     def validate_config(self):
 </s> add     def _validate_config(self) -> None: </s> remove     def add_new_config_items(self):
 </s> add     def _add_new_config_items(self) -> None: </s> remove         with open(self.configfile, "w") as f_cfgfile:
 </s> add         with open(self.configfile, "w", encoding="utf-8", errors="replace") as f_cfgfile: </s> remove         for section, items in self.defaults.items():
            self.insert_config_section(section, items["helptext"], new_config)
            for item, opt in items.items():
                if item == "helptext":
                    continue
                if section not in self.config.sections():
                    logger.debug("Adding new config section: '%s'", section)
                    opt_value = opt["default"]
 </s> add         for section_name, section in self.defaults.items():
            self.insert_config_section(section_name, section.helptext, new_config)
            for item, opt in section.items.items():
                if section_name not in self.config.sections():
                    logger.debug("Adding new config section: '%s'", section_name)
                    opt_value = opt.default </s> remove     def check_config_change(self):
        """ Check whether new default items have been added or removed
            from the config file compared to saved version """
 </s> add     def _check_config_change(self) -> bool:
        """ Check whether new default items have been added or removed from the config file
        compared to saved version

        Returns
        -------
        bool
            ``True`` if a config option has been added or removed
        """
        if self._check_config_change():
            self._add_new_config_items()
        self._check_config_choices()
      def validate_config(self):
          """ Check for options in default config against saved config
              and add/remove as appropriate """
          logger.debug("Validating config")
        if self._check_config_change():
            self._add_new_config_items()
        self._check_config_choices()
        if self._check_config_change():
            self._add_new_config_items()
        self._check_config_choices()
        if self._check_config_change():
            self._add_new_config_items()
        self._check_config_choices()
          logger.debug("Validated config")
  
      def add_new_config_items(self):
          """ Add new items to the config file """
          logger.debug("Updating config")
keep keep keep keep replace replace replace keep keep keep keep keep
 Preview - Allow mask color/opacity configuration
  - typing: lib.config
  - docs: lib.config
  - bugfix: popup_configure - keep assets on top 
lib/config.py