<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply_preliminary_config(self, save=True):
 """Applies the preliminary config to the configuration :param bool save: Whether the config file is be be written to the file system :return: Whether the applied changes require a refresh of the state machines :rtype: bool """

        state_machine_refresh_required = False
        for config_key, config_value in self.preliminary_config.items():
            self.config.set_config_value(config_key, config_value)
            if config_key in self.config.keys_requiring_state_machine_refresh:
                state_machine_refresh_required = True
            elif config_key in self.config.keys_requiring_restart:
                self.changed_keys_requiring_restart.add(config_key)
            if config_key == 'AUTO_RECOVERY_LOCK_ENABLED':
                import rafcon.gui.models.auto_backup
                if config_value:
                    rafcon.gui.models.auto_backup.generate_rafcon_instance_lock_file()
                else:
                    rafcon.gui.models.auto_backup.remove_rafcon_instance_lock_file()
        self.preliminary_config.clear()

        if save:
            self.config.save_configuration()
        return state_machine_refresh_required