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

Targets #442.

Please review.
This variable is used only onced. It can be merged into one line without problems.