python: Added some code for easier testing of WSGI handlers.