code: def get_writer_for_path(path, driver=None):
      """Return the writer class appropriate for the existing dataset."""
      if not driver:
          driver = get_dataset_driver(path)
      return get_writer_for_driver(driver)
  
imports: import logging
  import warnings
  from rasterio._base import get_dataset_driver, driver_can_create, driver_can_create_copy
  from rasterio._io import DatasetReaderBase, DatasetWriterBase, BufferedDatasetWriterBase, MemoryFileBase
  from rasterio.windows import WindowMethodsMixin
  from rasterio.env import ensure_env
  from rasterio.errors import RasterioDeprecationWarning
  from rasterio.transform import TransformMethodsMixin
  from rasterio._path import _UnparsedPath
label_desc: Use image node_id 2 for calling a global function with example usage: get_writer_for_path(path, driver) and returns: get_writer_for_driver