def university_domains():
    # type: () -> set
    """ Return list of university domains outside of .edu TLD
    NOTE: only 2nd level domain is returned, i.e. for aaa.bbb.uk only bbbl.uk
          will be returned. This is necessary since many universities use
          departmenntal domains, like cs.cmu.edu or andrew.cmu.edu
    NOTE2: .edu domains are not included into this list as they're considered
          belonging to universities by default.

    How to get the original CSV:
    ```python
    x = requests.get(
         "https://raw.githubusercontent.com/Hipo/university-domains-list/"
         "master/world_universities_and_domains.json").json()
    domains = set(ds for u in x
                  for ds in u['domains'] if not "edu" in ds.rsplit(".", 2)[-2:])
    domains = list(domains)
    pd.Series(domains, index=domains, name="domain"
    ).drop(
        ["chat.ru"]
    ).to_csv("email_university_domains.csv", index=False)
    ```
    """
    fpath = os.path.join(
        os.path.dirname(__file__), "email_university_domains.csv")
    with open(fpath) as fh:
        return set(addr_domain.strip() for addr_domain in fh)
def university_domains ( ) : fpath = os . path . join ( os . path . dirname ( __file__ ) , "email_university_domains.csv" ) with open ( fpath ) as fh : return set ( addr_domain . strip ( ) for addr_domain in fh )
Return list of university domains outside of .edu TLD
    NOTE: only 2nd level domain is returned, i.e. for aaa.bbb.uk only bbbl.uk
          will be returned. This is necessary since many universities use
          departmenntal domains, like cs.cmu.edu or andrew.cmu.edu
    NOTE2: .edu domains are not included into this list as they're considered
          belonging to universities by default.

    How to get the original CSV:
    ```python
    x = requests.get(
         "https://raw.githubusercontent.com/Hipo/university-domains-list/"
         "master/world_universities_and_domains.json").json()
    domains = set(ds for u in x
                  for ds in u['domains'] if not "edu" in ds.rsplit(".", 2)[-2:])
    domains = list(domains)
    pd.Series(domains, index=domains, name="domain"
    ).drop(
        ["chat.ru"]
    ).to_csv("email_university_domains.csv", index=False)
    ```