Must use mp_obj_get_type to get the type of an object. Can't assume mp_obj_t is castable to mp_obj_base_t.