code: def emit(self, record):
      from datalad.ui import ui
  
      if not hasattr(record, "dlm_progress"):
          self._clear_all()
          self._other_handler.emit(record)
          self._refresh_all()
          return
      maint = getattr(record, "dlm_progress_maint", None)
      if maint == "clear":
          return self._clear_all()
      elif maint == "refresh":
          return self._refresh_all()
      pid = getattr(record, "dlm_progress")
      update = getattr(record, "dlm_progress_update", None)
      # would be an actual message, not used ATM here,
      # and the record not passed to generic handler ATM
      # (filtered away by NoProgressLog)
      # so no final message is printed
      # msg = record.getMessage()
      if pid not in self.pbars:
          # this is new
          pbar = ui.get_progressbar(
              label=getattr(record, "dlm_progress_label", ""),
              unit=getattr(record, "dlm_progress_unit", ""),
              total=getattr(
                  record,
                  "dlm_progress_total",
                  None,
              ),
          )
          pbar.start(initial=getattr(record, "dlm_progress_initial", 0))
          self.pbars[pid] = pbar
      elif update is None:
          # not an update -> done
          # TODO if the other logging that is happening is less frontpage
          # we may want to actually "print" the completion message
          self.pbars.pop(pid).finish()
      else:
          # Check for an updated label.
          label = getattr(record, "dlm_progress_label", None)
          if label is not None:
              self.pbars[pid].set_desc(label)
          # an update
          self.pbars[pid].update(
              update,
              increment=getattr(
                  record, "dlm_progress_increment", False
              ),
              total=getattr(record, "dlm_progress_total", None),
          )
  
imports: from contextlib import contextmanager
  from functools import partial
  import inspect
  import logging
  import os
  import sys
  import platform
  import random
  import logging.handlers
  import warnings
  from os.path import basename, dirname
  from collections import defaultdict
  from .utils import is_interactive, optional_args
  from .support import ansi_colors
label_desc: Use image node_id 3 for calling the ProgressHandler obj's underlying member method code with example usage: obj.emit(record) and returns: self, self