Replace unicode with six.text_type, and str with six.binary_type
Make dict functions work across Python 2 and 3
Use six.callable() to work on Python 3.0 and 3.1
Update to work with urllib structure in Python 3
Make list.sort() calls Python 3 compatible
Only decode string of not already unicode
Avoid use of cmp() which is gone in Python 3