def toSecondLevelDomain(url):
    """
    Module function to get a second level domain from the given URL.
    
    @param url URL to extract domain from
    @type QUrl
    @return name of second level domain
    @rtype str
    """
    topLevelDomain = url.topLevelDomain()
    urlHost = url.host()
    if not topLevelDomain or not urlHost:
        return ''
    domain = urlHost[:len(urlHost) - len(topLevelDomain)]
    if domain.count('.') == 0:
        return urlHost
    while domain.count('.') != 0:
        domain = domain[domain.find('.') + 1:]
    return domain + topLevelDomain
