python3 compatibility:
cookielib -> http.cookiejar
urllib2 -> urllib.request