Add commands for checking whether a object has an attribute/method

Targets #442.

Please review.
Maybe would `_has_attr` be a better name