Fix deprecation warnings for asserts in Python 3.2+