Fix obsolete urlparse, iteritems; handle Python3 str