def METHOD_NAME(
    digest: Digest,
) -> tuple[datetime | None, datetime | None, Counter[Group]]:
    """
    Inspect a digest down to its events and return three pieces of data:
     - the timestamp of the FIRST event chronologically
     - the timestamp of the LAST event chronologically
     - the total number of groups
    """
    start: datetime | None = None
    end: datetime | None = None
    counts: Counter[Group] = Counter()
    for rule, groups in digest.items():
        counts.update(groups.keys())
        for group, records in groups.items():
            for record in records:
                if record.datetime:
                    if start is None or record.datetime < start:
                        start = record.datetime
                    if end is None or record.datetime > end:
                        end = record.datetime
    return start, end, counts