Handle struct format type differences

Python 3's struct takes Unicode formats but on Python 2 it must be
bytes.