Refactor repeated email normalization
These functions independently apply the same normalization rule. Extract the shared behavior once.
def email_label(email):
return email.strip().lower()
def contact_key(email):
return email.strip().lower()
The refactor should preserve both functions’ results while giving future changes one place to update.
Which refactor removes the duplicated normalization without changing either result?
Why it matters: A single implementation keeps identical rules consistent as a codebase evolves.