code: def annotation_has_expired(event, key, timeout):
      
      anns = get_annotations(event, key)
      if anns:
          return (time.time() - anns[0]["ts"]) > timeout
      else:
          return False
docs: Check if an event error has expired.