

def apex(url):
    'Usually returns the apex or registered domain, given a URL.'
    from urlparse import urlparse
    if url:
        apex = urlparse(apex).hostname.split('.')
        try:
            apex = '.'.join((((len(apex[(- 2)]) < 4) and apex[(- 3):]) or apex[(- 2):]))
            return apex
        except:
            return None
    else:
        return None

dataset/ETHPy150Open miklevin/pipulate/common.py apex/VarMisuse@26/53 `url`->`apex`