the preceding `try..catch` could be replaced by
```python
if not 'valid' in self.data or self.data['valid']:
```