code: def format_msg(fmt: str, use_color: bool = False) -> str:
      """Replace $RESET and $BOLD with corresponding ANSI entries"""
      if color_enabled() and use_color:
          return fmt.replace("$RESET", RESET_SEQ).replace(
              "$BOLD", BOLD_SEQ
          )
      else:
          return fmt.replace("$RESET", "").replace("$BOLD", "")
  
file_path: datalad/datalad/support/ansi_colors.py
imports: from __future__ import annotations
  import os
  from typing import Optional
  from ..None import cfg
  from ..ui import ui
label_desc: Use image node_id 2 for calling a global function with example usage: format_msg(fmt, use_color) and returns: fmt, fmt