def rule(event):
    if all(
        [
            "Security\\Trusted Locations\\Location" in event.deep_get("TargetObject", default=""),
            event.deep_get("TargetObject", default="").endswith("\\Path"),
            not any(
                [
                    all(
                        [
                            ":\\Program Files\\Common Files\\Microsoft Shared\\ClickToRun\\"
                            in event.deep_get("Image", default=""),
                            event.deep_get("Image", default="").endswith("\\OfficeClickToRun.exe"),
                        ]
                    ),
                    any(
                        [
                            ":\\Program Files\\Microsoft Office\\"
                            in event.deep_get("Image", default=""),
                            ":\\Program Files (x86)\\Microsoft Office\\"
                            in event.deep_get("Image", default=""),
                        ]
                    ),
                ]
            ),
            not any(
                [
                    "%APPDATA%\\Microsoft\\Templates" in event.deep_get("Details", default=""),
                    "%%APPDATA%%\\Microsoft\\Templates" in event.deep_get("Details", default=""),
                    "%APPDATA%\\Microsoft\\Word\\Startup" in event.deep_get("Details", default=""),
                    "%%APPDATA%%\\Microsoft\\Word\\Startup"
                    in event.deep_get("Details", default=""),
                    ":\\Program Files (x86)\\Microsoft Office\\root\\Templates\\"
                    in event.deep_get("Details", default=""),
                    ":\\Program Files\\Microsoft Office (x86)\\Templates"
                    in event.deep_get("Details", default=""),
                    ":\\Program Files\\Microsoft Office\\root\\Templates\\"
                    in event.deep_get("Details", default=""),
                    ":\\Program Files\\Microsoft Office\\Templates\\"
                    in event.deep_get("Details", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
