Standardize how Python version checking is done.

This uses `six.PY3` and `six.PY2` for version checks whenever possible.

The real reason to do this is not just for consistency, but so that `coverage.py` can automatically exclude blocks from coverage, without having to manually add a pragma comment.