def remove_small_segments(segmentation, min_size):
    """Remove small regions from a segmentation."""
    for i in segmentation.identifiers:
        region = segmentation.region_by_identifier(i)
        if region.area < min_size:
            segmentation[region] = 0
    return segmentation