def METHOD_NAME(model, state):
    if model == 'None':
        yield ("Not saving the settings because no model is loaded.")
        return
    with Path(f'{shared.args.model_dir}/config-user.yaml') as p:
        if p.exists():
            user_config = yaml.safe_load(open(p, 'r').read())
        else:
            user_config = {}
        model_regex = model + '$'  # For exact matches
        for _dict in [user_config, shared.model_config]:
            if model_regex not in _dict:
                _dict[model_regex] = {}
        if model_regex not in user_config:
            user_config[model_regex] = {}
        for k in ui.list_model_elements():
            if k == 'loader' or k in loaders.loaders_and_params[state['loader']]:
                user_config[model_regex][k] = state[k]
                shared.model_config[model_regex][k] = state[k]
        output = yaml.dump(user_config, sort_keys=False)
        with open(p, 'w') as f:
            f.write(output)
        yield (f"Settings for {model} saved to {p}")