The web.wsgi.base provides a class BaseMiddleware
which has methods to allow you to easily accomplish each of these things.
For some examples look at the source code of the web.wsgi middleware classes.
XXX More here
The WSGI application (or middleware stack) to which this middleware should be added.
You should not need to modify this method but is documented here for a complete understanding as it provides the functionality which makes derived classes WSGI middleware.
Provides the dictionary environ for modification. Must return the environ
dictionary to be passed on down the middleware chain.