[python] How to know if an object has an attribute in Python