def METHOD_NAME(
    groups: MutableMapping[str, Mapping[str, MutableSequence[Record]]], record: Record
) -> MutableMapping[str, Mapping[str, MutableSequence[Record]]]:
    group = record.value.event.group
    rules = record.value.rules
    if not rules:
        logger.debug(f"{record} has no associated rules, and will not be added to any groups.")
    for rule in rules:
        groups[rule][group].append(record)
    return groups