def METHOD_NAME(library, set_fields):
    library.open_pdf(TestFiles.vero_pdf)
    to_insert = {
        "Puhelinnumero": "12313123",  # new number
        "Paivays": "01.04.2021",  # new date
    }
    with temp_filename(suffix="-fields.pdf") as tmp_file:
        if set_fields:
            # Keep non-empty values, because null fields will fail the saving.
            existing_fields = library.get_input_fields(replace_none_value=True)
            for name, value in to_insert.items():
                library.set_field_value(name, value)
                assert existing_fields[name]["value"] == value
            library.save_field_values(output_path=tmp_file)
        else:
            # There are no fields retrieved at all this time.
            library.save_field_values(output_path=tmp_file, newvals=to_insert)
        library.switch_to_pdf(tmp_file)
        for name, value in to_insert.items():
            assert_field_value(library, name, value)