We should use the various `compat_*` down below and delete these imports, so that the code also runs on Python 3.