def ExecuteAfterDelay(time_s, func, *args, **kwargs):
  timeout = PolledTimeout.FromSeconds(time_s)

  def Target():
    time.sleep(timeout.remaining)
    try:
      func(*args, **kwargs)
    except Exception:  # pylint: disable=broad-except
      _LOG.exception('Error executing %s after %s expires.', func, timeout)
  if timeout.remaining is not None:
    thread = threading.Thread(target=Target)
    thread.start()
A function that executes the given function after a delay.
dataset/ETHPy150Open google/openhtf/openhtf/util/timeouts.py/ExecuteAfterDelay