Merge branch '0.3.4-fix-attach-pheader-587'
Reuse magic mime code

The same lines are in guess_encoding() and guess_mimetype() - so have
guess_mimetype() call guess_encoding()
Support two different versions of magic

The API for magic has changed at some point.  Debian and Ubuntu still
have an old version, but only the new version can be installed via pip.
This commit allows us to use either version.
Add inline comments around magic API hackery
Merge branch '0.3.4-fix-magic-588' into testing