Kindly be informed that the 'six' library will help you to write the code that is compatible with both Python 2 and Python 3.
The six.moves package will provide those modules under a general name for both Python2 and 3:
from six.moves import urllib
The above code will import urllib when run with Python3 and it will import a mixture of urllib, urllib2, and urlparse with Python2.