docs: def WriteForemanRule(self, rule, cursor=None):
      """Writes a foreman rule to the database."""
      query = ("INSERT INTO foreman_rules "
               "  (hunt_id, expiration_time, rule) "
               "VALUES (%s, FROM_UNIXTIME(%s), %s) "
               "ON DUPLICATE KEY UPDATE "
               "  expiration_time=FROM_UNIXTIME(%s), rule=%s")
  
      exp_str = mysql_utils.RDFDatetimeToTimestamp(rule.expiration_time),
      rule_str = rule.SerializeToString()
      cursor.execute(query, [rule.hunt_id, exp_str, rule_str, exp_str, rule_str])