code: def poll(args, pipeline_id=None, workflow_ids=None):
      print(
          f"Waiting for pipeline to complete (Branch: {args.branch})..."
      )
      while True:
          num = 0
          done = 0
          if pipeline_id:
              url = f"https://circleci.com/api/v2/pipeline/{pipeline_id}/workflow"
              r = requests.get(url, auth=(args.api_token, ""))
              assert (
                  r.status_code == 200
              ), f"Error making api request: {r}"
              d = r.json()
              workflow_ids = [item["id"] for item in d["items"]]
          num = len(workflow_ids)
          for work_id in workflow_ids:
              work_status_url = (
                  f"https://circleci.com/api/v2/workflow/{work_id}"
              )
              r = requests.get(
                  work_status_url, auth=(args.api_token, "")
              )
              # print("STATUS", work_status_url)
              assert (
                  r.status_code == 200
              ), f"Error making api work request: {r}"
              w = r.json()
              status = w["status"]
              print("Status:", status)
              if status not in ("running", "failing"):
                  done += 1
          if num and done == num:
              print("Finished")
              return
          time.sleep(20)
  
file_path: wandb/tools/circleci-tool.py
imports: import argparse
  import os
  import subprocess
  import sys
  import time
  import requests
label_desc: Use image node_id 1 for calling a global function with example usage: poll(args, pipeline_id, workflow_ids) without return types