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