PY3 = sys.version_info[0] == 3
if PY3:
+ # compat functions
+ from urllib.parse import quote as urllib_quote
+ from urllib.request import urlopen as urllib_urlopen
+
+ # compat types
integer_types = int,
+ string_types = str
text_type = str
else:
+ # compat functions
+ from urllib import quote as urllib_quote
+ from urllib import urlopen as urllib_urlopen
+
+ # compat types
integer_types = (int, long)
+ string_types = basestring
text_type = unicode