code: def get_ogr_driver(filepath):
      
      filename, file_extension = os.path.splitext(filepath)
      EXTENSION = file_extension[1:]
  
      ogr_driver_count = ogr.GetDriverCount()
      for idx in range(ogr_driver_count):
          driver = ogr.GetDriver(idx)
          driver_extension = driver.GetMetadataItem(str('DMD_EXTENSION')) or ''
          driver_extensions = driver.GetMetadataItem(str('DMD_EXTENSIONS')) or ''
  
          if EXTENSION == driver_extension or EXTENSION in driver_extensions:
              return driver
  
      else:
          msg = 'No driver found for the following file extension: {}'.format(
              EXTENSION)
          raise ValueError(msg)
docs: Get the OGR driver from the provided file extension.
  
      Args:
          file_extension (str): file extension
  
      Returns:
          osgeo.ogr.Driver
  
      Raises:
          ValueError: no driver is found