Domain parsing with Python