COMPAT: Python 3. Closes #2131.