def serialize(self, value): if is_password_hash(value): return value return generate_password_hash(value)