You can simplify this with primary_name = getattr(manager, "primary_name", "Name not given")