This is very similar to `external_common.check_type()`. 

Can you rewrite `external_common.check_type()` to fit all your new recent needs?