def normalize_alias_tuple(ns, nid):
    ns = clean_id(ns)
    ns = ns.lower()

    if ns == "biblio":
        return (ns, nid)

    nid = clean_id(nid)
    
    from totalimpact.providers import crossref
    from totalimpact.providers import pubmed
    from totalimpact.providers import arxiv
    from totalimpact.providers import webpage
    from totalimpact import importer

    clean_nid = None
    if ns=="doi" or importer.is_doi(nid):
        ns = "doi"
        clean_nid = crossref.clean_doi(nid)
    elif ns=="pmid" or importer.is_pmid(nid):
        ns = "pmid"
        clean_nid = pubmed.clean_pmid(nid)
    elif ns=="arxiv" or importer.is_arxiv(nid):
        ns = "arxiv"
        clean_nid = arxiv.clean_arxiv_id(nid)
    elif ns=="url" or importer.is_url(nid):
        ns = "url"
        clean_nid = webpage.clean_url(nid)
    elif ns not in ["doi", "pmid", "arxiv", "url"]:
        clean_nid = nid

    if not clean_nid:
        return None

    return (ns, clean_nid)
dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpactwebapp/aliases.py/normalize_alias_tuple/original