Python Check If Object Has Function