def rule(event):
    if all(
        [
            event.deep_get("Initiated", default="") == "true",
            "\\python" in event.deep_get("Image", default=""),
            ".exe" in event.deep_get("Image", default=""),
            not any(
                [
                    all(
                        [
                            event.deep_get("DestinationIp", default="") == "127.0.0.1",
                            event.deep_get("SourceIp", default="") == "127.0.0.1",
                        ]
                    ),
                    all(
                        [
                            "pip.exe" in event.deep_get("CommandLine", default=""),
                            "install" in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                ]
            ),
            not any(
                [
                    all(
                        [
                            event.deep_get("ParentImage", default="")
                            == "C:\\ProgramData\\Anaconda3\\Scripts\\conda.exe",
                            ":\\ProgramData\\Anaconda3\\Scripts\\conda-script.py"
                            in event.deep_get("CommandLine", default=""),
                            "update" in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                    all(
                        [
                            event.deep_get("ParentImage", default="")
                            == "C:\\ProgramData\\Anaconda3\\python.exe",
                            "C:\\ProgramData\\Anaconda3\\Scripts\\jupyter-notebook-script.py"
                            in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
