code: def check_bar_completed(capsys, width=40):
      out, err = capsys.readouterr()
      # trailing newline so grab next to last line for final state of bar
      bar, percent, time = (
          i.strip() for i in out.split("\r")[-2].split("|")
      )
      assert bar == "[" + "#" * width + "]"
      assert percent == "100% Completed"
  
file_path: distributed/distributed/diagnostics/tests/test_progressbar.py
imports: from __future__ import annotations
  from time import sleep
  import pytest
  from tornado.ioloop import IOLoop
  from distributed.diagnostics.progressbar import TextProgressBar, progress
  from distributed.metrics import time
  from distributed.utils_test import div, gen_cluster, inc
label_desc: Use image node_id 2 for calling a global function with example usage: check_bar_completed(capsys, width) without return types