def get_selection_groups(bm):
    """Group faces that are selected and adjacent to each other"""
    selected_faces = [f for f in bm.faces if f.select]

    def get_adjacent_selected(faces):
        return list({fa for f in faces for e in f.edges for fa in e.link_faces if fa.select})

    result = []
    while selected_faces:
        current = selected_faces[0]

        faces = [current]
        adjacent = get_adjacent_selected(faces)
        while len(adjacent) > len(faces):
            faces = adjacent[:]
            adjacent = get_adjacent_selected(faces)

        list(map(selected_faces.remove, adjacent))
        result.append(adjacent)
    return result