Deletes ClientStats older than a given timestamp.

def DeleteOldClientStats(self, yield_after_count,
                           retention_time
                          ):
    """Deletes ClientStats older than a given timestamp."""

    yielded = False

    while True:
      deleted_count = self._DeleteClientStats(
          limit=yield_after_count, retention_time=retention_time)

      # Do not yield a trailing 0 after any non-zero count has been yielded.
      # A trailing zero occurs, when an exact multiple of `yield_after_count`
      # rows were in the table.
      if not yielded or deleted_count > 0:
        yield deleted_count
        yielded = True

      # Return, when no more rows can be deleted, indicated by a transaction
      # that does not reach the deletion limit.
      if deleted_count < yield_after_count:
        return