This provides whisper with a capability similar to "rrdtool lastupdate": it returns the timestamp and value of the last metric added to the database. The utility can be used by a monitoring system to determine whether updates are still being received.
(I realize the search is potentially inefficient if, in fact, the database is not fairly current. However this implementation intentionally has minimal impact on the existing implementation. whisper would need some refactoring in both implementation and architecture to get something better.)
try: fh = open(...) finally: fh.close()
with open(...) as fh: do_stuff()
just is easier to look at and maintain.