Use urllib.parse from Six
Use six.binary_type and six.text_type for testing argument
Use six.iteritems