# Path: nolang/builtins/spec.py
# def unwrap_spec(**spec):
#     def wrapper(func):
#         func.unwrap_spec = spec
#         return func
#     return wrapper
# 
# def parameters(**args):
#     def wrapper(func):
#         func.unwrap_parameters = args
#         return func
#     return wrapper
# 
# Path: nolang/objects/usertype.py
# class W_UserType(W_Root):
#     def __init__(self, allocate, name, class_elements_w, w_parent,
#                  default_alloc=True, force_names=None):
#         self.name = name
#         self.allocate = allocate
#         self.class_elements_w = class_elements_w
#         self.default_alloc = default_alloc
#         if w_parent is not None:
#             self._dict_w = w_parent._dict_w.copy()
#         else:
#             self._dict_w = {}
#         for item in class_elements_w:
#             self._dict_w[item.name] = item
#         self.w_parent = w_parent
#         if force_names is None:
#             self.force_names = None
#         else:
#             self.force_names = {}
#             for elem in force_names:
#                 self.force_names[elem] = None
# 
#     def setup(self, space):
#         for item in self.class_elements_w:
#             item.setup(space)
# 
#     def call(self, space, interpreter, args_w, kwargs):
#         if self.allocate is None:
#             raise Exception("cannot be called like that")
#         w_obj = space.call(self.allocate, [self] + args_w, kwargs)
#         if '__init__' in self._dict_w:
#             space.call(self._dict_w['__init__'], [w_obj] + args_w, kwargs)
#         elif self.default_alloc:
#             if len(args_w) != 0:
#                 raise space.apperr(space.w_argerror, "Default constructor"
#                     " expecting no arguments")
#         return w_obj
# 
#     def getattr(self, space, attrname):
#         try:
#             return self._dict_w[attrname]
#         except KeyError:
#             return space.w_NotImplemented
# 
#     def issubclass(self, w_type):
#         cur = self
#         while cur is not None:
#             if cur is w_type:
#                 return True
#             cur = cur.w_parent
#         return False
# 
#     def __repr__(self):
#         return "<UserType %s>" % (self.name,)


from nolang.builtins.spec import unwrap_spec, parameters
from nolang.objects.usertype import W_UserType


@unwrap_spec()
def len(space, w_obj):
    return space.newint(space.len(w_obj))


@parameters(name='isinstance')
def builtin_isinstance(space, w_obj, w_type):

# Path: nolang/builtins/spec.py
# def unwrap_spec(**spec):
#     def wrapper(func):
#         func.unwrap_spec = spec
#         return func
#     return wrapper
# 
# def parameters(**args):
#     def wrapper(func):
#         func.unwrap_parameters = args
#         return func
#     return wrapper
# 
# Path: nolang/objects/usertype.py
# class W_UserType(W_Root):
#     def __init__(self, allocate, name, class_elements_w, w_parent,
#                  default_alloc=True, force_names=None):
#         self.name = name
#         self.allocate = allocate
#         self.class_elements_w = class_elements_w
#         self.default_alloc = default_alloc
#         if w_parent is not None:
#             self._dict_w = w_parent._dict_w.copy()
#         else:
#             self._dict_w = {}
#         for item in class_elements_w:
#             self._dict_w[item.name] = item
#         self.w_parent = w_parent
#         if force_names is None:
#             self.force_names = None
#         else:
#             self.force_names = {}
#             for elem in force_names:
#                 self.force_names[elem] = None
# 
#     def setup(self, space):
#         for item in self.class_elements_w:
#             item.setup(space)
# 
#     def call(self, space, interpreter, args_w, kwargs):
#         if self.allocate is None:
#             raise Exception("cannot be called like that")
#         w_obj = space.call(self.allocate, [self] + args_w, kwargs)
#         if '__init__' in self._dict_w:
#             space.call(self._dict_w['__init__'], [w_obj] + args_w, kwargs)
#         elif self.default_alloc:
#             if len(args_w) != 0:
#                 raise space.apperr(space.w_argerror, "Default constructor"
#                     " expecting no arguments")
#         return w_obj
# 
#     def getattr(self, space, attrname):
#         try:
#             return self._dict_w[attrname]
#         except KeyError:
#             return space.w_NotImplemented
# 
#     def issubclass(self, w_type):
#         cur = self
#         while cur is not None:
#             if cur is w_type:
#                 return True
#             cur = cur.w_parent
#         return False
# 
#     def __repr__(self):
#         return "<UserType %s>" % (self.name,)


# Path: nolang/builtins/builtin.py
from nolang.builtins.spec import unwrap_spec, parameters
from nolang.objects.usertype import W_UserType



@unwrap_spec()
def len(space, w_obj):
    return space.newint(space.len(w_obj))


@parameters(name='isinstance')
def builtin_isinstance(space, w_obj, w_type):

    if not isinstance(w_type, W_UserType):