<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_locale(request):
 """Return locale from GET lang param or automatically."""

    return request.query.get('lang', app.ps.babel.select_locale_by_request(request))