def rule(event):
    if all(
        [
            event.deep_get("type", default="") == "EXECVE",
            event.deep_get("a0", default="") == "xwd",
            any(
                [
                    all(
                        [
                            event.deep_get("a1", default="") == "-root",
                            event.deep_get("a2", default="") == "-out",
                            event.deep_get("a3", default="").endswith(".xwd"),
                        ]
                    ),
                    all(
                        [
                            event.deep_get("a1", default="") == "-out",
                            event.deep_get("a2", default="").endswith(".xwd"),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
