Human: check if a variable exists Assistant: 
Here is some code to check if object `obj` has attribute 'attr_name'

hasattr(obj, 'attr_name')

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.