Use the second argument of .get for the default value, then you don't need to init the post_type:
```python
post_type = item.get('type', '')
```
And remove the if block.