Type-checking with isinstance