+if sys.version_info[0] < 3:
+ from HTMLParser import HTMLParser
+ from urllib import urlopen, urlretrieve, urlencode
+ def get_encoding(info):
+ return info.getparam('charset')
+
+else:
+ from html.parser import HTMLParser
+ from urllib.request import urlopen, urlretrieve
+ from urllib.parse import urlencode
+ def get_encoding(info):
+ return info.get_content_charset('ascii')