def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("Image", default="").endswith("/apt"),
                    event.deep_get("Image", default="").endswith("/apt-get"),
                ]
            ),
            "APT::Update::Pre-Invoke::=" in event.deep_get("CommandLine", default=""),
        ]
    ):
        return True
    return False
