Adds Python 3.x support to userdata script

Replaces six.StringIO with io.BytesIO in gzip inflation.
Marks also content as bytes where necessary.