py_has_attr function

Check if a Python object has an attribute