code: def take_at_most_n_seconds(time_s, func, *args, **kwargs):
    
    thread = threading.Thread(target=func, args=args, kwargs=kwargs)
    thread.start()
    thread.join(time_s)
    if thread.is_alive():
      return False
    return True
docs: A function that returns whether a function call took less than time_s.
  
    NOTE: The function call is not killed and will run indefinitely if hung.
  
    Args:
      time_s: Maximum amount of time to take.
      func: Function to call.
      *args: Arguments to call the function with.
      **kwargs: Keyword arguments to call the function with.
    Returns:
      True if the function finished in less than time_s seconds.