@contextlib.contextmanager
def TakeAtLeastNSeconds(time_s):
  timeout = PolledTimeout(time_s)
  yield
  while not timeout.HasExpired():
    time.sleep(timeout.remaining)
A context manager which ensures it takes at least time_s to execute.
dataset/ETHPy150Open google/openhtf/openhtf/util/timeouts.py/TakeAtLeastNSeconds