python: Raise IndexError when adding the same network twice