Proper type checking/comparison using "isinstance"