Support Python 3

Part of #232

Cola now runs on both Python 2.6+ and 3! Many refactorings were
necessary for this. The first commits are about modernizing the py2 codebase and adding necessary `__future__` imports, and the last commit is the real thing.

In-house "six-like" compat unit: Because there were only a few
compatibility tricks needed, I felt that it was overkill to add a
dependency on the "six" module, so I added the necessary compatibility
tricks in cola.compat:

* ustr: replaces all previous instances of `unicode`.
* unichr: Alias of `chr` under py3.
* StringIO: Import from `cStringIO` under py2 and `io` under py3.
* urllib: Aliases to `urllib.parse` under py3.

Then, there's a couple of small fixes that had to be made:

* StandardError --> Exception
* except foo, e --> except foo as e
* foo.reverse() --> reversed(foo)
* xrange() --> range() (minimal perf impact under py2)
* iteritems() --> items() (minimal perf impact under py2)
* Wrapping list() where needed (filter(), map(), etc.)
* `__next__` = `next` aliasing

Also, there were a couple of places where `core.encode()` was used and
didn't have to. Under py2, it did nothing, but under py3, it generated
an error. I've tried to be as careful and minimal as possible for that
part, but if there's one area where there's a risk of newly indtroduced
bugs, it's that part.

There were also "cmp" functions that had to be replaced with "key"
functions.