code: def print_progress_tqdm(hps, metrics, pbar, is_notebook, clear=True):
      """Custom writer for tqdm which prints winning metrics
      to console after each iteration.
  
      Uses a hack for tqdm.write(): https://github.com/tqdm/tqdm/issues/520
  
      # Arguments:
          hps: dict of hyperparameters
          metrics: dict of hyperparameters+metrics
          pbar: a tqdm progressbar
          is_notebook: boolean if automl-gs is running in a Notebook.
          clear: if writing should clear existing output
      """
  
      # hp_str = '\n'.join(['{}: {}'.format(k, v) for k, v in hps.items()])
      metrics_str = "\n".join(
          [
              "{}: {}".format(k, v)
              for k, v in metrics.items()
              if k not in hps.keys()
          ]
      )
  
      # console_str = ("\nHyperparameters:\n" + hp_str + "\n" +
      #              "\nMetrics:\n" + metrics_str)
  
      console_str = "\nMetrics:\n" + metrics_str
  
      # Print to console, removing appropriate number of lines
      move_up_char = "" if is_notebook else _term_move_up()
      if clear:
          pbar.write(
              "".join([move_up_char] * (console_str.count("\n") + 2))
          )
  
      pbar.write(console_str)
  
imports: import re
  import pandas
  import random
  import yaml
  import os
  import shutil
  from time import time
  from pkg_resources import resource_filename
  from tqdm import tqdm, tqdm_notebook
  from tqdm._utils import _term_move_up
  from subprocess import Popen, PIPE, DEVNULL, CalledProcessError
  from autopep8 import fix_code
  from collections import OrderedDict
label_desc: Use image node_id 4 for calling a global function with example usage: print_progress_tqdm(hps, metrics, pbar, is_notebook, clear) without return types