I would prefer the following; it seems more idiomatic and is 2x faster in a quick benchmark I just did:

```python
contains_x_forward = 'X_FORWARDED_FOR' in env
```