urllib and urlparse imports for python3 compatibility