def map_url_in(request, env, app=False):
    "route incoming URL"

    #  initialize router-url object
    #
    THREAD_LOCAL.routes = params  # default to base routes
    map = MapUrlIn(request=request, env=env)
    map.sluggify()
    map.map_prefix()  # strip prefix if present
    map.map_app()     # determine application

    #  configure THREAD_LOCAL.routes for error rewrite
    #
    if params.routes_app:
        THREAD_LOCAL.routes = params_apps.get(app, params)

    if app:
        return map.application

    root_static_file, version = map.map_root_static(
    )  # handle root-static files
    if root_static_file:
        map.update_request()
        return (root_static_file, version, map.env)
    # handle mapping of lang/static to static/lang in externally-rewritten URLs
    # in case we have to handle them ourselves
    if map.languages and map.map_static is False and map.arg0 == 'static' and map.languages in map.args(1):
        map.map_controller()
        map.map_language()
    else:
        map.map_language()
        map.map_controller()
    static_file, version = map.map_static()
    if static_file:
        map.update_request()
        return (static_file, version, map.env)
    map.map_function()
    map.validate_args()
    map.update_request()
    return (None, None, map.env)
dataset/ETHPy150Open uwdata/termite-visualizations/web2py/gluon/rewrite.py/map_url_in/swapped operands of `in`