Python 2 fix - should still work in Python 3 too. (urlparse)
Added ouimeaux backwards compatible port behavior - using 54321 by default but it's overridable.