# Path: tenable_io/exceptions.py
# class TenableIOException(Exception):
# 
#     def __init__(self, message=None, code=None):
#         self.code = code if code else TenableIOErrorCode.GENERIC
#         self.message = message if message else self.code.description
# 
#     def __str__(self):
#         return self.message
# 
# Path: tenable_io/util.py
# def payload_filter(payload, filter_):
#     if callable(filter_):
#         payload = {k: v for k, v in payload.items() if filter_(v, k)}
#     elif filter:
#         payload = {k: v for k, v in payload.items() if v is not None}
#     return payload


from json import loads
from tenable_io.exceptions import TenableIOException
from tenable_io.util import payload_filter
                    for item in list_:
                        if isinstance(item, class_):
                            model_list.append(item)
                        elif isinstance(item, dict):
                            model_list.append(class_.from_dict(item))
                        else:
                            raise TenableIOException(u'Invalid element type.')
                    f(self, model_list)
                else:
                    f(self, [])
            return wrapper
        return decorator

    @staticmethod
    def _model(class_):
        """
        :param class_: The class that the value should be an instance of.
        :return: A decorator that ensures the assigning value is of `class_` instances.
        """
        assert issubclass(class_, BaseModel)

        def decorator(f):
            def wrapper(self, model):
                if isinstance(model, class_):
                    f(self, model)
                elif isinstance(model, dict):
                    f(self, class_.from_dict(model))
                elif model is None:
                    f(self, None)
                else:

# Path: tenable_io/exceptions.py
# class TenableIOException(Exception):
# 
#     def __init__(self, message=None, code=None):
#         self.code = code if code else TenableIOErrorCode.GENERIC
#         self.message = message if message else self.code.description
# 
#     def __str__(self):
#         return self.message
# 
# Path: tenable_io/util.py
# def payload_filter(payload, filter_):
#     if callable(filter_):
#         payload = {k: v for k, v in payload.items() if filter_(v, k)}
#     elif filter:
#         payload = {k: v for k, v in payload.items() if v is not None}
#     return payload


# Path: tenable_io/api/models.py
from json import loads
from tenable_io.exceptions import TenableIOException
from tenable_io.util import payload_filter

                    for item in list_:
                        if isinstance(item, class_):
                            model_list.append(item)
                        elif isinstance(item, dict):
                            model_list.append(class_.from_dict(item))
                        else:
                            raise TenableIOException(u'Invalid element type.')
                    f(self, model_list)
                else:
                    f(self, [])
            return wrapper
        return decorator

    @staticmethod
    def _model(class_):
        """
        :param class_: The class that the value should be an instance of.
        :return: A decorator that ensures the assigning value is of `class_` instances.
        """
        assert issubclass(class_, BaseModel)

        def decorator(f):
            def wrapper(self, model):
                if isinstance(model, class_):
                    f(self, model)
                elif isinstance(model, dict):
                    f(self, class_.from_dict(model))
                elif model is None:
                    f(self, None)
                else:

                    raise TenableIOException(u'Invalid value type.')