Returns client-activity metrics for a particular statistic.

    Args:
      day_buckets: A set of n-day-active buckets.
      extract_statistic_fn: A function that extracts the statistic's value from
        a ClientFullInfo object.

def _CountClientStatisticByLabel(self, day_buckets, extract_statistic_fn):
    """Returns client-activity metrics for a particular statistic.

    Args:
      day_buckets: A set of n-day-active buckets.
      extract_statistic_fn: A function that extracts the statistic's value from
        a ClientFullInfo object.
    """
    counts = collections.defaultdict(int)
    now = rdfvalue.RDFDatetime.Now()
    for info in self.IterateAllClientsFullInfo(batch_size=db.MAX_COUNT):
      if not info.metadata.ping:
        continue
      statistic_value = extract_statistic_fn(info)
      for client_label in info.GetLabelsNames(owner="GRR"):
        for day_bucket in day_buckets:
          time_boundary = now - rdfvalue.Duration.FromDays(day_bucket)
          if info.metadata.ping > time_boundary:
            # Count the client if it has been active in the last 'day_bucket'
            # days.
            counts[(statistic_value, client_label, day_bucket)] += 1
    return dict(counts)