defaultdict is not in python 2.4, you should import from compat:
```python
from compat import defaultdict
```