code: def test_write_mode_on_non_existing_memoryfile(
      profile_first_coutwildrnp_shp,
  ):
      """Exception is raised if a memoryfile is opened in write mode on a non empty memoryfile"""
      profile, first = profile_first_coutwildrnp_shp
      profile["driver"] = "GeoJSON"
      with MemoryFile() as memfile:
          with memfile.open(**profile) as col:
              col.write(first)
          with pytest.raises(IOError):
              with memfile.open(mode="w"):
                  pass
  
imports: import os
  from io import BytesIO
  import pytest
  import fiona
  from fiona import supported_drivers
  from fiona.drvsupport import _driver_supports_mode
  from fiona.errors import DriverError
  from fiona.io import MemoryFile, ZipMemoryFile
  from fiona.meta import supports_vsi
  from .conftest import requires_gdal2, requires_gpkg
label_desc: Use image node_id 27 for calling a global function with example usage: test_write_mode_on_non_existing_memoryfile(profile_first_coutwildrnp_shp) without return types