def METHOD_NAME(biomes):
    valid_biomes = []
    for biome in biomes['biomes']:
        if not biome['boxes'] or not biome['name'].strip() or REGEX_INVALID_BIOME.search(biome['name']):
            continue
        if biome['name'] == 'Underwater':
            biome['priority'] = -1
            # Remove underwater regions in the middle of the map
            valid_boxes = []
            for box in biome['boxes']:
                if not ((box['start']['x'] > -300000 and box['end']['x'] < 300000) and
                        (box['start']['y'] > -300000 and box['end']['y'] < 300000)):
                    valid_boxes.append(box)
            biome['boxes'] = valid_boxes
        elif biome['name'] == 'Deep Ocean':
            biome['priority'] = -2
        valid_biomes.append(biome)
    return valid_biomes