any reason to use `hasattr` instead of `isinstance`?