Use the same attribute checking as done in NumPy.