def add(self, interceptor, order):
        if not isinstance(interceptor, Interceptor):
            raise InvalidInterceptionTableParameterError("interceptor is not an instance of Interceptor")
        if not isinstance(order, int):
            raise InvalidInterceptionTableParameterError("order is not an integer")

        # Ensure script type is correct for given interceptor
        if self.type == 'mo' and interceptor.script.type != 'moi':
            raise InvalidInterceptionTableParameterError("Script type '%s' is not valid for MO Interceptor",
                                                         interceptor.script.type)
        elif self.type == 'mt' and interceptor.script.type != 'mti':
            raise InvalidInterceptionTableParameterError("Script type '%s' is not valid for MT Interceptor",
                                                         interceptor.script.type)

        if order < 0:
            raise InvalidInterceptionTableParameterError("order must be 0 (default interceptor) or greater")
        if order != 0 and interceptor.type != self.type:
            raise InvalidInterceptionTableParameterError("interceptor must be of type '%s', '%s' was given",
                                                         self.type, interceptor.type)
        if order == 0 and interceptor.type != 'default':
            raise InvalidInterceptionTableParameterError(
                "interceptor with order=0 must be a DefaultInterceptor")

        # Replace older interceptors with the same given order
        self.remove(order)

        self.table.append({order: interceptor})
        self.table.sort(reverse=True)
dataset/ETHPy150Open jookies/jasmin/jasmin/routing/InterceptionTables.py/InterceptionTable.add/original