Python 3: Fix module names in import

Use six.moves to fix imports on Python 3.

Change-Id: I35b9405690e9f0607b24d79aa7c00830df954c41
Python 3: Get compatible types from six

* Replace unicode with six.text_type
* Replace basestring with six.string_types
* The long type doesn't exist in Python 3 anymore: replace 1L with long(1) and
  only test this type with Python 2
* Fix quote(): quote the URL if the string is a byte string. Use "bytes" type
  instead of "str" to be Python 3 compatible.

Change-Id: I1df5aa85e4e7d07191fb5c654d52fc4bd8b9f440
Merge "Python 3: Get compatible types from six"