Note that python -O removes all asserts. It would be better to explicitly raise AssertionError