def METHOD_NAME(tmp_path):
    """Test writing modified metadata to drawio file."""
    tmp_drawio_file = tmp_path / 'test.drawio'
    shutil.copyfile(
        pathlib.Path('tests/data/author/0.0.1/drawio/single_tab_metadata_compressed.drawio'), tmp_drawio_file
    )
    draw_io = DrawIO(tmp_drawio_file)
    diagram_idx = 0
    metadata_flat = draw_io.get_metadata()[diagram_idx]
    metadata_structured = draw_io.restructure_metadata(metadata_flat)
    metadata_structured['test'] = 'modified value'
    metadata_structured['nested']['nested']['test'] = 'deep modification'
    draw_io.write_drawio_with_metadata(tmp_drawio_file, metadata_structured, diagram_idx)
    draw_io_mod = DrawIO(tmp_drawio_file)
    mod_metadata = draw_io_mod.get_metadata()[diagram_idx]
    mod_metadata = draw_io.restructure_metadata(mod_metadata)
    assert mod_metadata['test'] == 'modified value'
    assert mod_metadata['nested']['nested']['test'] == 'deep modification'