def _persist_settings(config_manager):
serializable_data = config_manager.get_serializable()<EOL>try:<EOL><INDENT>_try_persist_settings(serializable_data)<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>_remove_non_serializable_store_entries(serializable_data["<STR_LIT>"][SCRIPT_GLOBALS])<EOL>_try_persist_settings(serializable_data)<EOL><DEDENT>
Write the settings, including the persistent global script Store.
The Store instance might contain arbitrary user data, like function objects, OpenCL contexts, or whatever other
non-serializable objects, both as keys or values.
Try to serialize the data, and if it fails, fall back to checking the store and removing all non-serializable
data.