def METHOD_NAME(tree, options):
    scope = options.get("config_scope")
    config = options.get("config")
    instance_config_dir = f"{tree}/etc/default"
    os.makedirs(instance_config_dir, exist_ok=True)
    if scope == "distro":
        filepath = instance_config_dir + "/instance_configs.cfg.distro"
    else:
        filepath = instance_config_dir + "/instance_configs.cfg"
    parser = iniparse.SafeConfigParser()
    try:
        with open(filepath, "r", encoding="utf8") as f:
            parser.readfp(f)
    except FileNotFoundError:
        print(f"Creating new guest-agent configuration file at '{filepath}'.")
        os.makedirs(instance_config_dir, exist_ok=True)
    for section_id, section_content in config.items():
        make_section(parser, section_id, section_content)
    with open(filepath, "w", encoding="utf8") as f:
        parser.write(f)
    return 0