Fancy networks

See docs/networks.md for details.

Unit tests pass, but I should write some more unit tests to test the expanded functionality before we merge this.
I went and started at the code for a bit, with `docs/networks.md` next to it and worked out what this is checking -- namely that a particular invariant is enforced. State which invariant it's checking in the docstring.

The name of the function is clearly trying its hardest to convey this, but variable names can only do so much.