We have a strict 10-minute window. If our program runs too long, it gets cut off and we lose data!
datetime and timedelta.The Astro Pi system kills any process running longer than 10 minutes. We need to save our result.txt and close files before that happens.
time_limit to timedelta(seconds=2) and add a time.sleep(1) inside the loop to see the safety break in action.