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

  Args:
    label: Client label to fetch data for.
    report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for.
    period: rdfvalue.Duration specifying how far back in time to fetch data. If
      not provided, all data for the given label and report-type will be
      returned.
    token: ACL token to use for reading from the legacy (non-relational)
      datastore.

  Raises:
    AFF4AttributeTypeError: If, when reading to the legacy DB, an unexpected
    report-data type is encountered.

  Returns:
    A dict mapping timestamps to graph-series. The timestamps
    represent when the graph-series were written to the datastore.

def FetchAllGraphSeries(
    label,
    report_type,
    period = None,
    token = None
):
  """Fetches graph series for the given label and report-type from the DB.

  Args:
    label: Client label to fetch data for.
    report_type: rdf_stats.ClientGraphSeries.ReportType to fetch data for.
    period: rdfvalue.Duration specifying how far back in time to fetch data. If
      not provided, all data for the given label and report-type will be
      returned.
    token: ACL token to use for reading from the legacy (non-relational)
      datastore.

  Raises:
    AFF4AttributeTypeError: If, when reading to the legacy DB, an unexpected
    report-data type is encountered.

  Returns:
    A dict mapping timestamps to graph-series. The timestamps
    represent when the graph-series were written to the datastore.
  """
  if _ShouldUseLegacyDatastore():
    return _FetchAllGraphSeriesFromTheLegacyDB(
        label, report_type, period=period, token=token)

  if period is None:
    time_range = None
  else:
    range_end = rdfvalue.RDFDatetime.Now()
    time_range = time_utils.TimeRange(range_end - period, range_end)
  return data_store.REL_DB.ReadAllClientGraphSeries(
      label, report_type, time_range=time_range)