You shouldn't compare identity against booleans (pep-8).
Use:
```python
elif msg_wrapper.dirty:
```