code: def static_partial_tile_sizes(width, height, tilesize, scale_factors):
      
      for sf in scale_factors:
          if (sf * tilesize >= width and sf * tilesize >= height):
              continue  # avoid any full-region tiles
          rts = tilesize * sf  # tile size in original region
          xt = (width - 1) // rts + 1
          yt = (height - 1) // rts + 1
          for nx in range(xt):
              rx = nx * rts
              rxe = rx + rts
              if (rxe > width):
                  rxe = width
              rw = rxe - rx
              # same as sw = int(math.ceil(rw/float(sf)))
              sw = (rw + sf - 1) // sf
              for ny in range(yt):
                  ry = ny * rts
                  rye = ry + rts
                  if (rye > height):
                      rye = height
                  rh = rye - ry
                  # same as sh = int(math.ceil(rh/float(sf)))
                  sh = (rh + sf - 1) // sf
                  yield([rx, ry, rw, rh], [sw, sh])
docs: Generator for partial tile sizes for zoomed in views.
  
      Positional arguments:
      width -- width of full size image
      height -- height of full size image
      tilesize -- width and height of tiles
      scale_factors -- iterable of scale factors, typically [1,2,4..]
  
      Yields ([rx,ry,rw,rh],[sw,sh]), the region and size for each tile