Port twisted.web.client.Agent functionality to Python 3

After these fixes, I successfully run 'HTTP Persistent Connection' example from https://twistedmatrix.com/documents/14.0.0/web/howto/client.html