Replace print statement with print function (for Python 3).
Replace bytearray.next with next(bytearray) (for Python 3).