code: def time_to_yield(self):
          
          delta = self.ioloop.time() - self.done_since
          if self.done and delta > self.max_loop_latency:
              return True
          return False
docs: Call after check_future(). If True, it is time to yield tornado.gen.moment