this was failing in python 2.7 because bytes is just an alias for str. Fortunately, bytearray is reentrant so bytearray(bytearray()) is equivalent to bytearray()