conditional getattr