Wraps around a few calls which need to be made in the same thread.

def _wrapper(self):
        """
        Wraps around a few calls which need to be made in the same thread.
        """
        try:
            res = self.func(*self.args, **self.kw)
        except Exception as e:
            self.mediator.set_error(e)
        else:
            self.mediator.set_result(res)