Reads graph series for the given label and report-type from the DB.

def ReadAllClientGraphSeries(
      self,
      client_label,
      report_type,
      time_range = None,
      cursor=None):
    """Reads graph series for the given label and report-type from the DB."""
    query = """
      SELECT UNIX_TIMESTAMP(timestamp), graph_series
      FROM client_report_graphs
      WHERE client_label = %s AND report_type = %s
    """
    args = [client_label, report_type.SerializeToDataStore()]

    if time_range is not None:
      query += "AND `timestamp` BETWEEN FROM_UNIXTIME(%s) AND FROM_UNIXTIME(%s)"
      args += [
          mysql_utils.RDFDatetimeToTimestamp(time_range.start),
          mysql_utils.RDFDatetimeToTimestamp(time_range.end)
      ]

    cursor.execute(query, args)
    results = {}
    for timestamp, raw_series in cursor.fetchall():
      # TODO(hanuszczak): pytype does not seem to understand overloads, so it is
      # not possible to correctly annotate `TimestampToRDFDatetime`.
      timestamp = cast(rdfvalue.RDFDatetime,
                       mysql_utils.TimestampToRDFDatetime(timestamp))

      series = rdf_stats.ClientGraphSeries.FromSerializedString(raw_series)
      results[timestamp] = series
    return results