code: def writeout(ds, outfn):
      
      print("Writing out %s" % outfn) 
      #Use outfn extension to get driver
      #This may have issues if outfn already exists and the mem ds has different dimensions/res
      out_ds = iolib.gtif_drv.CreateCopy(outfn, ds, 0, options=iolib.gdal_opt)
      out_ds = None
docs: Write ds to disk
  
      Note: Depreciated function - use diskwarp functions when writing to disk to avoid unnecessary CreateCopy