def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("Image", default="").endswith("python.exe"),
                    event.deep_get("Image", default="").endswith("python3.exe"),
                    event.deep_get("Image", default="").endswith("python2.exe"),
                ]
            ),
            any(
                [
                    all(
                        [
                            "import pty" in event.deep_get("CommandLine", default=""),
                            ".spawn(" in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                    "from pty import spawn" in event.deep_get("CommandLine", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
