def initContact(contactId: str): assert contactId not in activeContacts activeContacts.add(contactId) contact = dir.getContact(contactId) contactsToEmails[contactId] = contact['email'] name = " ".join( filter(None, [ contact.get('title_before_name'), contact.get('first_name'), contact.get('last_name'), contact.get('title_after_name') ])) #name = name.translate(str.maketrans('', '', string.punctuation)) name = name.translate(str.maketrans('', '', '@')) name = HumanName(name.lower().strip()) name.capitalize() if re.search('^(\w\.)+$', name.first): name.first = name.first.upper() contactsToNames[contactId] = name.__str__()