[WIP] Add is_type command, is_instance_of command

targets #492 
I'm not sure, but I think this function could possibly return `NULL`, resulting in a segfault here. Check the return value please!