docs: def _clean_up_gene_id(geneid, sp, curie_map):
          """
          A series of identifier rewriting to conform with
          standard gene identifiers.
          :param geneid:
          :param sp:
          :return:
          """
          # special case for MGI
          geneid = re.sub(r'MGI:MGI:', 'MGI:', geneid)
  
          # rewrite Ensembl --> ENSEMBL
          geneid = re.sub(r'Ensembl', 'ENSEMBL', geneid)
  
          # rewrite Gene:CELE --> WormBase
          # these are old-school cosmid identifier
          geneid = re.sub(r'Gene:CELE', 'WormBase:', geneid)
          if sp == 'CAEEL':
              if re.match(r'(Gene|ENSEMBLGenome):\w+\.\d+', geneid):
                  geneid = re.sub(
                      r'(?:Gene|ENSEMBLGenome):(\w+\.\d+)',
                      r'WormBase:\1', geneid)
  
          if sp == 'DROME':
              if re.match(r'(ENSEMBLGenome):\w+\.\d+', geneid):
                  geneid = re.sub(
                      r'(?:ENSEMBLGenome):(\w+\.\d+)', r'FlyBase:\1', geneid)
  
          # rewrite GeneID --> NCBIGene
          geneid = re.sub(r'GeneID', 'NCBIGene', geneid)
  
          # rewrite Gene:Dmel --> FlyBase
          geneid = re.sub(r'Gene:Dmel_', 'FlyBase:', geneid)
          # rewrite Gene:CG --> FlyBase:CG
          geneid = re.sub(r'Gene:CG', 'FlyBase:CG', geneid)
  
          # rewrite ENSEMBLGenome:FBgn --> FlyBase:FBgn
          geneid = re.sub(r'ENSEMBLGenome:FBgn', 'FlyBase:FBgn', geneid)
  
          # rewrite Gene:<ensembl ids> --> ENSEMBL:<id>
          geneid = re.sub(r'Gene:ENS', 'ENSEMBL:ENS', geneid)
  
          # rewrite Gene:<Xenbase ids> --> Xenbase:<id>
          geneid = re.sub(r'Gene:Xenbase:', 'Xenbase:', geneid)
  
          # TODO this would be much better done as
          # if foo not in selfcurie_map:
          # if re.match(r'(Gene|ENSEMBLGenome):', geneid) or \
          #        re.match(r'Gene_ORFName', geneid) or \
          #        re.match(r'Gene_Name', geneid):
          #    # LOG.warning(
          #    #"Found an identifier I don't know how to fix (species %s): %s",
          #    #   sp, geneid)
  
          pfxlcl = re.split(r':', geneid)
          pfx = pfxlcl[0]
          if pfx is None or pfx not in curie_map:
              # LOG.warning( "No curie prefix for (species %s): %s", sp, geneid)
              geneid = None
          return geneid