On further relection, how about this instead?
```python
return request.GET.get('lang') and not any(request.path.endswith(url) for url in EXEMPT_URLS)
```