Fixed a few things for python3.

This PR fixes most tests under python3. Note that this requires six for both python 2 and 3.
Maybe six should be included as vendor.