<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ReadClientLastPings(self, min_last_ping=None, max_last_ping=None, fleetspeak_enabled=None, cursor=None):
 """Reads client ids for all clients in the database."""

    query = "SELECT client_id, UNIX_TIMESTAMP(last_ping) FROM clients "
    query_values = []
    where_filters = []
    if min_last_ping is not None:
      where_filters.append("last_ping >= FROM_UNIXTIME(%s) ")
      query_values.append(mysql_utils.RDFDatetimeToTimestamp(min_last_ping))
    if max_last_ping is not None:
      where_filters.append(
          "(last_ping IS NULL OR last_ping <= FROM_UNIXTIME(%s))")
      query_values.append(mysql_utils.RDFDatetimeToTimestamp(max_last_ping))
    if fleetspeak_enabled is not None:
      if fleetspeak_enabled:
        where_filters.append("fleetspeak_enabled IS TRUE")
      else:
        where_filters.append(
            "(fleetspeak_enabled IS NULL OR fleetspeak_enabled IS FALSE)")

    if where_filters:
      query += "WHERE " + "AND ".join(where_filters)
    cursor.execute(query, query_values)
    last_pings = {}
    for int_client_id, last_ping in cursor.fetchall():
      client_id = db_utils.IntToClientID(int_client_id)
      last_pings[client_id] = mysql_utils.TimestampToRDFDatetime(last_ping)
    return last_pings