[python] Determine if variable is defined in Python