As is, this needs to handle the ``bytes`` type in py3, but the above suggestion would fix that.