code: def progress_bar(current, total, msg=None):
      global last_time, begin_time
      if current == 0:
          begin_time = time.time()  # Reset for new bar.
  
      cur_len = int(TOTAL_BAR_LENGTH * current / total)
      rest_len = int(TOTAL_BAR_LENGTH - cur_len) - 1
  
      sys.stdout.write(" [")
      for i in range(cur_len):
          sys.stdout.write("=")
      sys.stdout.write(">")
      for i in range(rest_len):
          sys.stdout.write(".")
      sys.stdout.write("]")
  
      cur_time = time.time()
      step_time = cur_time - last_time
      last_time = cur_time
      tot_time = cur_time - begin_time
  
      L = []
      L.append("  Step: %s" % format_time(step_time))
      L.append(" | Tot: %s" % format_time(tot_time))
      if msg:
          L.append(" | " + msg)
  
      msg = "".join(L)
      sys.stdout.write(msg)
      for i in range(term_width - int(TOTAL_BAR_LENGTH) - len(msg) - 3):
          sys.stdout.write(" ")
  
      # Go back to the center of the bar.
      for i in range(term_width - int(TOTAL_BAR_LENGTH / 2) + 2):
          sys.stdout.write("\b")
      sys.stdout.write(" %d/%d " % (current + 1, total))
  
      if current < total - 1:
          sys.stdout.write("\r")
      else:
          sys.stdout.write("\n")
      sys.stdout.flush()
  
file_path: nni/examples/trials/cifar10_pytorch/utils.py
imports: import os
  import sys
  import time
  import torch
  import torch.nn
  import torch.nn.init
label_desc: Use image node_id 3 for calling a global function with example usage: progress_bar(current, total, msg) without return types