Python Check If Variable Is Defined As