<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __send_log_set_exc_and_wait(self, msg, level=None, wait_seconds=CONN_RETRY_DELAY_SECONDS):
 """To be called in exception context only. msg - message to log level - logging level. If not specified, ERROR unless it is a repeated failure in which case DEBUG. If specified, the given level will always be used. wait_seconds - how long to pause for (so retry is not triggered immediately) """

        logger.log(
            ((logging.DEBUG if self.__send_exc else logging.ERROR) if level is None else level),
            msg,
            exc_info=DEBUG_ENABLED
        )
        self.__send_exc_time = monotonic()
        self.__send_exc = exc_info()[1]
        self.__end.wait(wait_seconds)