def METHOD_NAME(raster_source: 'RasterSource',
                     label_source: 'ObjectDetectionLabelSource',
                     chip_size: int,
                     nb_windows: int,
                     max_attempts: int,
                     filter_windows: Callable,
                     chip_nodata_threshold: float = 1.) -> List[Box]:
    extent = raster_source.extent
    neg_windows = []
    for _ in range(max_attempts):
        for _ in range(max_attempts):
            window = extent.make_random_square(chip_size)
            if any(filter_windows([window])):
                break
        chip = raster_source.get_chip(window)
        labels = ObjectDetectionLabels.get_overlapping(
            label_source.get_labels(), window, ioa_thresh=0.2)
        # If no labels and not too many nodata pixels, append the chip
        nodata_below_thresh = nodata_below_threshold(
            chip, chip_nodata_threshold, nodata_val=0)
        if len(labels) == 0 and nodata_below_thresh:
            neg_windows.append(window)
        if len(neg_windows) == nb_windows:
            break
    return list(neg_windows)