def _split_into_common_flow_groups(nodes, min_common_cells=2):
    """Return list of lists where all nodes in each sublist have common flow for at least 'min_common_cells'
    at the end."""
    if len(nodes) <= 1:
        return [nodes]
    reverse_index = -1 * min_common_cells
    groups = []
    unhandled_nodes = list(nodes)
    while unhandled_nodes:
        this_n = unhandled_nodes[0]
        this_geom = this_n['geometry']
        this_group = [this_n]
        unhandled_nodes.remove(this_n)
        if len(this_geom) > min_common_cells:
            for other_n in list(unhandled_nodes):
                other_geom = other_n['geometry']
                if len(other_geom) > min_common_cells and this_geom[
                    reverse_index] == other_geom[reverse_index]:
                    this_group.append(other_n)
                    unhandled_nodes.remove(other_n)
        groups.append(this_group)
    return groups
