Fixed stream multipart encoding for python3

See #572