<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wait_on_event(self, in_event_type, timeout, capture_timeout=False):
 """Waits for an occurrence of the specified event in this resource. :param in_event_type: Logical identifier of the event(s) to wait for. :param timeout: Absolute time period in time units that the resource shall wait for a specified event to occur before returning the time elapsed error. The time unit is in milliseconds. None means waiting forever if necessary. :param capture_timeout: When True will not produce a VisaIOError(VI_ERROR_TMO) but instead return a WaitResponse with timed_out=True :return: A WaitResponse object that contains event_type, context and ret value. """

        try:
            event_type, context, ret = self.visalib.wait_on_event(self.session, in_event_type, timeout)
        except errors.VisaIOError as exc:
            if capture_timeout and exc.error_code == constants.StatusCode.error_timeout:
                return WaitResponse(in_event_type, None, exc.error_code, self.visalib, timed_out=True)
            raise
        return WaitResponse(event_type, context, ret, self.visalib)