A more pythonic way to say this would be

```python
if params.get('buy_shirt') != 'on':
```

since ``dict.get()`` returns ``None`` when the key doesn't exist.