code: def set_events_callback(self, call_back):
          
          logger.info("setting event callback")
          callback_wrap = ctypes.CFUNCTYPE(None, ctypes.c_void_p,
                                           ctypes.POINTER(snap7.snap7types.SrvEvent),
                                           ctypes.c_int)
  
          def wrapper(usrptr, pevent, size):
              """
              Wraps python function into a ctypes function
  
              :param usrptr: not used
              :param pevent: pointer to snap7 event struct
              :param size:
              :returns: should return an int
              """
              logger.info("callback event: " + self.event_text(pevent.contents))
              call_back(pevent.contents)
              return 0
  
          self._callback = callback_wrap(wrapper)
          usrPtr = ctypes.c_void_p()
          return self.library.Srv_SetEventsCallback(self.pointer, self._callback, usrPtr)
docs: Sets the user callback that the Server object has to call when an
          event is created.