Please don't use hasattr(), as it "eats" exceptions. Use getattr instead.