title: Can I move beaker.SessionMiddleware to handle method somehow?
body: <p>It's a bit ugly that many lines of code fall into <code>"__main__"</code>.
  Can someone give me a tip of how to move SessionMiddleware into handle method?
  I should notice that I use session in CoreXmlParser.
  Thanks in advance !</p>
  
  <pre><code>def handle(environ, start_response):
          req = webob.Request(environ)
          c = CoreXmlParser(req)
          resp = webob.Response(body=c(), charset = 'utf-8', status='200 OK', \
          request=req, content_type='text/xml')
          resp(environ, start_response)
          return resp.app_iter
  
      if __name__ == '__main__':
          #parse config file for session options
          app = SessionMiddleware(handle, some_session_opts_here)
          from flup.server.fcgi import WSGIServer
          WSGIServer(app).run()
  </code></pre>