I'd be fine using:

```python
return any(request.path.endswith(url) for url in EXEMPT_URLS)
```

As a replacement for line 42. But I'm not sure it won't be slightly slower due to it finishing all the urls before returning. A reasonable list likely won't matter though, and I can't imaging the EXEMPT_URLS growing past 2 or 3.