Add Python 3 compatibility and encode binary payloads with UTF-8

Before the socket would have failed with an error due to missing encoding. I did some tests and saw that the server socket will decode a UTF-8 string transparently, but dd-agent should probably be updated to decode UTF-8 strings explicitly. This will probably be necessary if dd-agent supports Python 3.
Any reason to make this required for installation of the package? I saw it used in a test only.