def muntjac(application, host='localhost', port=8880, nogui=False,
            debug=False, serve=True, forever=True, servletClass=None,
            *args, **kw_args):

    if servletClass is None:
        servletClass = ApplicationServlet

    level = logging.DEBUG if debug else logging.INFO

    logging.basicConfig(stream=sys.stdout, level=level,
            format='%(levelname)s: %(message)s')

    wsgi_app = servletClass(application, debug=debug, *args, **kw_args)

    wsgi_app = SessionMiddleware(wsgi_app, session_class=InMemorySession)

    url = 'http://%s:%d/' % (host, port)

    if nogui == False:
        webbrowser.open(url, new=0)

    httpd = make_server(host, port, wsgi_app)

    if serve:
        print 'Serving at: %s' % url
        if forever:
            # Respond to requests until process is killed
            httpd.serve_forever()
        else:
            # Serve one request, then exit
            httpd.handle_request()
dataset/ETHPy150Open rwl/muntjac/muntjac/main.py/muntjac/original