def METHOD_NAME(
    record: Record,
    project: Project,
    groups: Mapping[int, Group],
    rules: Mapping[str, Rule],
) -> Record | None:
    event = record.value.event
    # Reattach the group to the event.
    group = groups.get(event.group_id)
    if group is not None:
        event.group = group
    else:
        logger.debug(f"{record} could not be associated with a group.")
        return None
    return Record(
        record.key,
        Notification(event, [_f for _f in [rules.get(id) for id in record.value.rules] if _f]),
        record.timestamp,
    )