For example, the address is:
Address = http://lol1.domain.com:8888/some/page>
Address = http://lol1.domain.com:8888/some/page
What you are looking for is in: http://docs.python.org/library/urlparse.html
for example: ".".join(urlparse('http://www.my.cwi.nl:80/%7Eguido/Python.html').netloc.split(".")[:-2])
".".join(urlparse('http://www.my.cwi.nl:80/%7Eguido/Python.html').netloc.split(".")[:-2])
Will do the job for you (will return "www.my")