def __exit__(self, exc_type, exc_val, exc_tb):
    t1 = time.monotonic()
    if ((t1 - self.t0) >= self.duration):
        self.alarm()
def __exit__(self, exc_type, exc_val, exc_tb):
    t1 = time.monotonic()
    if ((t1 - self.t0) >= self.duration):
        self.alarm()