Cleanup + large file uploads + misc stuff

Fixes misc shit, see individual commits, import as you like.
The thing I was really after was being able to upload large files without having to read them into memory at once, hence multipart.py ;)
After that I just cleaned stuff up a bit to make it pass flake8 and added some minor improvements.

Pull/Cherry-pick as you please.