compat: Fix expected bytes type on Python 2.