code: def get_zooms(src_dst, ensure_global_max_zoom=False, tilesize=256):
      
      bounds = transform_bounds(
          *[src_dst.crs, "epsg:4326"] + list(src_dst.bounds), densify_pts=21
      )
      center = [(bounds[0] + bounds[2]) / 2, (bounds[1] + bounds[3]) / 2]
      lat = center[1] if ensure_global_max_zoom else 0
  
      dst_affine, w, h = calculate_default_transform(
          src_dst.crs, "epsg:3857", src_dst.width, src_dst.height, *src_dst.bounds
      )
  
      mercator_resolution = max(abs(dst_affine[0]), abs(dst_affine[4]))
  
      # Correction factor for web-mercator projection latitude scale change
      latitude_correction_factor = math.cos(math.radians(lat))
      adjusted_resolution = mercator_resolution * latitude_correction_factor
  
      max_zoom = zoom_for_pixelsize(adjusted_resolution, tilesize=tilesize)
  
      ovr_resolution = adjusted_resolution * max(h, w) / tilesize
      min_zoom = zoom_for_pixelsize(ovr_resolution, tilesize=tilesize)
  
      return (min_zoom, max_zoom)
docs: Calculate raster min/max mercator zoom level.
  
      Parameters
      ----------
      src_dst: rasterio.io.DatasetReader
          Rasterio io.DatasetReader object
      ensure_global_max_zoom: bool, optional
          Apply latitude correction factor to ensure max_zoom equality for global
          datasets covering different latitudes (default: False).
      tilesize: int, optional
          Mercator tile size (default: 256).
  
      Returns
      -------
      min_zoom, max_zoom: Tuple
          Min/Max Mercator zoom levels.