Fix lint complaints about type comparisons
This MR fixes lint complaints from flake8 to do with exact type comparisons, replacing all with calls to isinstance.
This MR fixes lint complaints from flake8 to do with exact type comparisons, replacing all with calls to isinstance.