Maybe use [urlparse](http://docs.python.org/2/library/urlparse.html) instead?