cmp was removed in python3, but it's still used
sort no longer takes cmp=
fix cmp=, also the output of _build_query_string needs to be a string
Fix unittest.mock imports
and apparently python26 doesn't have cmp_to_key, oy