Add python 3 support

This adds support for python 3.3 and above.

The `except … as e:` exception syntax is compatible with python 2.6 and above. Python 3 doesn't support the `except …, e` syntax.

`iteritems()`, `xrange`, `unicode` and `file` are gone. I replaced them with the version-agnostic alternatives.

Metaclass syntax changed and I chose to copy the `with_metaclass` function from six instead of adding a dependency.

If you're happy with the changes, when making a new release, it'd be great to run `setup.py sdist register` again to register the new classifiers that declare the package as python3-compatible.