code: def choose_progress_callback(
      progress_bar: Union[str, ProgressCallback]
  ) -> ProgressCallback:
      if progress_bar == "auto":
          if not f_rich_progress.dummy:
              progress_bar = "rich"
          else:
              progress_bar = "raw"
      if progress_bar == "rich":
          return RichCallback()
      elif progress_bar == "raw":
          return RawTextCallback()
      elif progress_bar == "tqdm":
          return TqdmCallback()
      elif isinstance(progress_bar, ProgressCallback):
          return progress_bar
      else:
          return None
  
imports: import json
  from typing import Union
  from .has_monitor_callback import HasMonitorCallback
  from fastNLP.core.utils import f_rich_progress, f_tqdm_progress
  from fastNLP.core.log import logger
label_desc: Use image node_id 1 for calling a global function with example usage: choose_progress_callback(progress_bar) and returns: RichCallback, RawTextCallback, TqdmCallback, progress_bar, None