base64.encodestring needs a bytearray in python3