def serve(ip, port, application, **kwargs):
    """
    Serve a wsgi app (any wsgi app) through with either werkzeug's runserver
    or the one that comes with python.
    """
    try:
        from werkzeug.serving import run_simple
        run_simple(ip, port, application, **kwargs)
        return
    except ImportError:
        pass
    from wsgiref.simple_server import make_server
    server = make_server(ip, port, application)
    print('Serving on %s:%s' % (ip, port))
    try:
        server.serve_forever()
    except KeyboardInterrupt:
        pass
