Fix SSL socket wrapping and Python 2.7.9 compatibility

This is connected to GH #135 and BitBucket #165
Reformat with autopep8
Python 3 compat: Fix precedence bug
Python 3 compat: Improve SSL and WSGI compat
Clean up
Allow more gracefull shutdown of wsgi server

Currently, if the listening socket is closed the
wsgi.server will go into an infinite loop.

Add an 'is_accepting' flag which can be set to False
to tell the server to exit. This allows, for example,
a signal handler to initiate a gracefull shutdown
(complete existing requests then exit).