code: def check(sweep_id, num=None, result=None, stopped=None):
      settings = wandb.InternalApi().settings()
      api = wandb.Api(overrides=settings)
      sweep = api.sweep(f"{PROJECT}/{sweep_id}")
      runs = sorted(
          sweep.runs,
          key=lambda run: run.summary.get("val_acc", 0),
          reverse=True,
      )
      if num is not None:
          print(f"CHECKING: runs, saw: {len(runs)}, expecting: {num}")
          assert len(runs) == num
      val_acc = None
      cnt_stopped = 0
      for run in runs:
          print(
              "stop debug",
              run.id,
              getattr(run, "stopped", None),
              run.state,
          )
          if getattr(run, "stopped", None) or run.state == "stopped":
              cnt_stopped += 1
          tmp = run.summary.get("val_acc")
          assert tmp is not None
          val_acc = tmp if val_acc is None or tmp > val_acc else val_acc
      if stopped is not None:
          print(
              f"NOT CHECKING: stopped, saw: {cnt_stopped}, expecting: {stopped}"
          )
          # todo: turn on stopped run state
      if result is not None:
          print(
              f"CHECKING: metric, saw: {val_acc}, expecting: {result}"
          )
          assert val_acc == result
      print("ALL GOOD")
  
file_path: wandb/tests/standalone_tests/sweep_check.py
imports: import argparse
  import os
  import shutil
  import time
  import requests
  import wandb
label_desc: Use image node_id 4 for calling a global function with example usage: check(sweep_id, num, result, stopped) without return types