@contextlib.contextmanager
def heartbeat_timer(self):
    heartbeat_timer = timer.Timer(self.heartbeat, interval=60)
    (yield)
    heartbeat_timer.stop()
@contextlib.contextmanager
def heartbeat_timer(self):
    heartbeat_timer = timer.Timer(self.heartbeat, interval=60)
    (yield)
    heartbeat_timer.stop()