Utility function - asserts that obj is an instance of kclass. Throws an exception if it is not or returns obj cast to T on success.
The KClass of the expected type of obj.
The object that should be tested.
The expected type of obj.