def METHOD_NAME(self, msg_type, handler):
    doc = self.session._document
    def wrapper(*args, **kwargs):
        if msg_type == 'comm_open':
            return
        with set_curdoc(doc):
            state.execute(partial(handler, *args, **kwargs), schedule=True)
    return wrapper