def Wait(self):
    """Wait until the next action is needed."""
    time.sleep(self.sleep_time - int(self.sleep_time))

    # Split a long sleep interval into 1 second intervals so we can heartbeat.
    for _ in xrange(int(self.sleep_time)):
      time.sleep(1)

      if self.heart_beat_cb:
        self.heart_beat_cb()

    # Back off slowly at first and fast if no answer.
    self.sleep_time = min(
        self.poll_max,
        max(self.poll_min, self.sleep_time) * self.poll_slew)
dataset/ETHPy150Open google/grr/grr/client/comms.py/Timer.Wait/original