py: Improve __build_class__.
diff --git a/py/obj.c b/py/obj.c
index 77580e1..7d0122c 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -13,6 +13,15 @@
 #include "runtime.h"
 #include "map.h"
 
+mp_obj_t mp_obj_get_type(mp_obj_t o_in) {
+    if (MP_OBJ_IS_SMALL_INT(o_in)) {
+        return (mp_obj_t)&int_type;
+    } else {
+        mp_obj_base_t *o = o_in;
+        return (mp_obj_t)o->type;
+    }
+}
+
 const char *mp_obj_get_type_str(mp_obj_t o_in) {
     if (MP_OBJ_IS_SMALL_INT(o_in)) {
         return "int";