Use `isinstance()` for all type comparisons
Merge pull request #611 from stevensons/isinstance-for-comparisons

Use `isinstance()` for all type comparisons