def inject_lang_code(request, endpoint, values):
    """Returns a dict with the values for the given endpoint.  You must not alter
    the dict because it might be shared.  If the given endpoint does not exist
    `None` is returned.
    """
    rv = values
    if 'lang_code' not in rv:
        try:
            if request.url_adapter.map.is_endpoint_expecting(
                    endpoint, 'lang_code'):
                rv = values.copy()
                rv['lang_code'] = request.view_lang or str(request.locale)
        except __HOLE__:
            return
    return rv
dataset/ETHPy150Open mitsuhiko/solace/solace/application.py/inject_lang_code