code: def driver_from_extension(path):
      """
      Attempt to auto-detect driver based on the extension.
  
      Parameters
      ----------
      path: str or pathlike object
          The path to the dataset to write with.
  
      Returns
      -------
      str:
          The name of the driver for the extension.
      """
      try:
          # in case the path is a file handle
          # or a partsed path
          path = path.name
      except AttributeError:
          pass
  
      driver_extensions = raster_driver_extensions()
      try:
          return driver_extensions[
              os.path.splitext(path)[-1].lstrip(".").lower()
          ]
      except KeyError:
          raise ValueError(
              "Unable to detect driver. Please specify driver."
          )
  
imports: import os
  from rasterio._base import _raster_driver_extensions
  from rasterio.env import ensure_env
label_desc: Use image node_id 2 for calling a global function with example usage: driver_from_extension(path) and returns: driver_extensions