Improve Python 3 compatibility (urlparse vs urllib.parse)