code: def bbox_to_mip(self, bbox, mip, to_mip):
      
      if not type(bbox) is Bbox:
        bbox = lib.generate_slices(
          bbox, 
          self.mip_bounds(mip).minpt, 
          self.mip_bounds(mip).maxpt, 
          bounded=False
        )
        bbox = Bbox.from_slices(bbox)
  
      def one_level(bbox, mip, to_mip):
        original_dtype = bbox.dtype
        # setting type required for Python2
        downsample_ratio = self.mip_resolution(mip).astype(np.float32) / self.mip_resolution(to_mip).astype(np.float32)
        bbox = bbox.astype(np.float64)
        bbox *= downsample_ratio
        bbox.minpt = np.floor(bbox.minpt)
        bbox.maxpt = np.ceil(bbox.maxpt)
        bbox = bbox.astype(original_dtype)
        return bbox
  
      delta = 1 if to_mip >= mip else -1
      while (mip != to_mip):
        bbox = one_level(bbox, mip, mip + delta)
        mip += delta
  
      return bbox
docs: Convert bbox or slices from one mip level to another.