def _coerce(self, value): if value is not None and not isinstance(value, babel.Locale): return babel.Locale.parse(value) return value