def watch_one_event(event_filter, callback, timeout_callback, timeout, args,
                        start_time=None):
        """
        Start to watch one event.

        :param event_filter:
        :param callback:
        :param timeout_callback:
        :param timeout:
        :param args:
        :param start_time:
        :return:
        """
        if timeout and not start_time:
            start_time = int(datetime.now().timestamp())

        if not args:
            args = []

        while True:
            try:
                events = event_filter.get_all_entries()
                if events:
                    callback(events[0], *args)
                    return

            except (ValueError, Exception) as err:
                # ignore error, but log it
                logger.debug(f'Got error grabbing keeper events: {str(err)}')

            time.sleep(0.1)
            if timeout:
                elapsed = int(datetime.now().timestamp()) - start_time
                if elapsed > timeout:
                    if timeout_callback:
                        timeout_callback(*args)
                    else:
                        callback(None, *args)
                    break
def watch_one_event ( event_filter , callback , timeout_callback , timeout , args , start_time = None ) : if timeout and not start_time : start_time = int ( datetime . now ( ) . timestamp ( ) ) if not args : args = [ ] while True : try : events = event_filter . get_all_entries ( ) if events : callback ( events [ 0 ] , * args ) return except ( ValueError , Exception ) as err : logger . debug ( f'Got error grabbing keeper events: {str(err)}' ) time . sleep ( 0.1 ) if timeout : elapsed = int ( datetime . now ( ) . timestamp ( ) ) - start_time if elapsed > timeout : if timeout_callback : timeout_callback ( * args ) else : callback ( None , * args ) break
Start to watch one event.

        :param event_filter:
        :param callback:
        :param timeout_callback:
        :param timeout:
        :param args:
        :param start_time:
        :return: