code: def wait_for_terminal_dag_state(dag_id, dag_run_id):
      print(
          f" Simplified representation of DAG {dag_id} ".center(72, "=")
      )
      pprint(api_request("GET", f"dags/{DAG_ID}/details"))
  
      # Wait 80 seconds
      for _ in range(400):
          dag_state = api_request(
              "GET", f"dags/{dag_id}/dagRuns/{dag_run_id}"
          ).get("state")
          print(f"Waiting for DAG Run: dag_state={dag_state}")
          sleep(1)
          if dag_state in ("success", "failed"):
              break
  
file_path: airflow/docker_tests/test_docker_compose_quick_start.py
imports: from __future__ import annotations
  import json
  import os
  import shlex
  import subprocess
  import sys
  from pprint import pprint
  from shutil import copyfile
  from time import monotonic, sleep
  import requests
  from docker_tests.command_utils import run_command
  from docker_tests.constants import SOURCE_ROOT
  from docker_tests.docker_tests_utils import docker_image
label_desc: Use image node_id 3 for calling a global function with example usage: wait_for_terminal_dag_state(dag_id, dag_run_id) without return types