Use hasattr instead of getattr + None