Fixed stream multipart encoding for python3

Fixes an error probably introduced in `6cde94ce`