def apex(url):
  """Usually returns the apex or registered domain, given a URL."""
  from urlparse import urlparse
  if url:
    apex = urlparse(url).hostname.split(".")
    try:
      apex = ".".join(len(apex[-2]) < 4 or apex[-3:] or apex[-2:])
      return apex
    except:
      return None
  else:
    return None
dataset/ETHPy150Open miklevin/pipulate/common.py/apex/operator `and` -> `or`