"""Bolna substitutes absent %(param)s values as literal strings like "None" — normalize those artifacts to real nulls before they reach storage.""" from typing import Optional _NULL_ARTIFACTS = {"none", "null", "", "undefined", "not applicable", "n/a", "nil"} def clean(value: Optional[str]) -> Optional[str]: if value is None: return None if value.strip().lower() in _NULL_ARTIFACTS: return None return value.strip()