Fix Python 2.5 compatibility issues.

This branch fixes some Python 2.5 related issues and test failures.

Now tests pass with all the supported versions:

```bash
[TOX] py25: commands succeeded
[TOX] py26: commands succeeded
[TOX] py27: commands succeeded
[TOX] pypy: commands succeeded
[TOX] py32: commands succeeded
[TOX] py33: commands succeeded
[TOX] congratulations :)
```