code: def _mark_grid_bounds(self, plane, region_bbox):
          
          # Grid boundaries
          vbars = np.zeros([self.num_rows, self.num_cols + 1], dtype=np.bool)
          hbars = np.zeros([self.num_rows + 1, self.num_cols], dtype=np.bool)
  
          def closest_idx(arr, elem):
              left = bisect.bisect_left(arr, elem) - 1
              right = bisect.bisect_right(arr, elem) - 1
              return left if abs(arr[left] - elem) < abs(arr[right] - elem) else right
  
          # Figure out which separating segments are missing, i.e. merge cells
          for row, (y0, y1) in enumerate(self.yranges):
              yc = (y0 + y1) // 2
              for l in plane.find((region_bbox.x0, yc, region_bbox.x1, yc)):
                  vbars[row, closest_idx(self.xs, l.xc)] = True
          for col, (x0, x1) in enumerate(self.xranges):
              xc = (x0 + x1) // 2
              for l in plane.find((xc, region_bbox.y0, xc, region_bbox.y1)):
                  hbars[closest_idx(self.ys, l.yc), col] = True
          return vbars, hbars
docs: Assume all lines define a complete grid over the region_bbox.
          Detect which lines are missing so that we can recover merged
          cells.