We should replace all assertions with exceptions (probably `RuntimeError`). Assertions will not fire if Python was invoked with `-O`.