Python 3 support!

As promised ;-)

This was mostly straightforward, the only odd thing was that strings now do have an `__iter__` method, so checking `not hasattr(foo, '__iter__')` wasn't doing what you intended. I've replaced those with plain `isinstance` checks.