docs: def waiting_filter(lte_time, conn=None):
      """
      generates a filter for status==waiting and
      time older than lte_time
      """
      if RBO.index_list().contains(IDX_OUTPUT_JOB_ID).run(conn):
          return (r.row[START_FIELD] <= lte_time)
      else:
          return ((r.row[STATUS_FIELD] == WAITING) &
              (r.row[START_FIELD] <= lte_time))