Why not just change this to 
```python
if 'lang' in request.GET and request.path not in EXEMPT_URLS:
```
instead of using the separate function? wouldn't that accomplish the same purpose?