Is there any way I can import the python 3 version of 'bytes' into python 2?
Question: I am writing python code and I want to support python 2 and 3. One of the most
prominent data types I'm dealing with is immutable sequences of bytes, so I
want to find an elegant way to deal with the disparity between python 2
'bytes' (aliased to 'str') and python 3 'bytes' (specifically, the different
ways in which they slice and iterate are very annoying to me).

At first I tried using 'bytearray' because it seemed to have the same behavior
in both python 2 and 3, but the fact that it is mutable is problematic,
because I need my objects to be hashable.

If there is no way to access the python3 'bytes' behavior in python 2, the
current solution I'm thinking of trying is this: convert all sequences
(whether they be python 2 'bytes'/'str' or python 3 'bytes') to tuples of
integers.

Is there anything else I should consider for a solution assuming I can't use
the python 3 'bytes' type in python 2?


Answer: Use [`six` module](http://pythonhosted.org/six/) and its [`b()`
literal](http://pythonhosted.org/six/#six.b) or [`binary_type`
class](http://pythonhosted.org/six/#six.binary_type). This will take burden of
checking Python version from you.

