code: def unfinished(finished_status,
                 update_interval,
                 status_key,
                 edit_at_key):
      
      return {
          "$or": [
              {status_key: {"$lt": finished_status}},
              {edit_at_key: {"$lt": x_seconds_before_now(update_interval)}},
          ]
      }
docs: Create dict query for pymongo that getting all unfinished task.
  
      :param finished_status: int, status code that less than this
          will be considered as unfinished.
      :param update_interval: int, the record will be updated every x seconds.
      :param status_key: status code field key, support dot notation.
      :param edit_at_key: edit_at time field key, support dot notation.
  
      :return: dict, a pymongo filter.
  
  
      **中文文档**
  
      状态码小于某个值, 或者, 现在距离更新时间已经超过一定阈值.