def _psc1(psc1, psc2_from_psc1): if 'TEST' in psc1.upper(): # skip test subjects logging.debug('skipping test subject "%s"', psc1) else: # find and skip subjects with invalid identifier if psc1[-3:] in {'FU2', 'FU3'}: psc1 = psc1[:-3] elif psc1[-2:] == 'SB': psc1 = psc1[:-2] if psc1 in psc2_from_psc1: return psc1 elif psc1 in {'0x0000xxxxxx'}: logging.info('skipping known invalid subject identifier "%s"', psc1) else: logging.error('invalid subject identifier "%s"', psc1) return None