To check for “shouldn't happen” errors, you can
is some condition that should be
true. If the condition is false, Python raises an
AssertionError exception (see Section 25, “Exceptions: Error signaling and handling”).
If a second expression
provided, the value of that expression is passed with the
Assertion checking can be disabled by running Python
-O (optimize) option.