userdatautils is expected to operate on bytes, but on Python 3,
email.message.Message.get_payload returns a string, not a byte string
as for Python 2. This patch also includes a change to parthandler.py,
where we're using encoding.write_file instead of writing the file manually,
since encoding.write_file knows how to normalize its arguments properly.
Change-Id: Ic0b75a18d0a13bdf1dcb5b0b6430a5ac8f99ab74