Support Python 3.

I've tested this with Python 3.3, but below should work as well, and there shouldn't be anything in here limiting support on 2.x either.

Tests pass, except for test_cache, which depends on gevent/asis which is not available on 3, so those tests are skipped.