Replace uses of `as_string` from the email lib.

The `as_string` function from the `email` module assumes that it's being used
to encode a message for, well, email transmission -- and as a result, it
changes lines beginning with "From " into lines beginning with ">From ". Given
that we're using this for multipart uploads, this is surely not what we want.

We basically inline the body of `as_string`, setting `mangle_from_` to
`False`.

PTAL @skelterjohn