To make the library run under both Python versions with the same code, we need to address the str vs bytes problem.
In Python 2, bytes is an alias for str. In Python 3, bytes is a separate class. These two, despite having the same name, behave completely different: they take different arguments to construct, they return different types when indexed and str and repr don't do the same.
Possible solutions:
- Use the
bytes class in future.builtins, from pip install future
- Use the
six bridging library (undesireable, it cannot be exposed to the API user)