def pseudonymize(colname): if colname not in key: sha3 = hashlib.sha3_512() data = salt + colname sha3.update(data.encode('utf-8')) hexdigest = sha3.hexdigest() key[colname] = hexdigest return hexdigest else: return key[colname]