add flatten_conns as an inverse function for unflatten_conns; add "test_flatten.ipynb" as test for them.