code: def test_format_msg():
      fmt = r"a$BOLDb$RESETc$BOLDd$RESETe"
      for enabled in (True, False):
          with patch(
              "datalad.support.ansi_colors.color_enabled",
              lambda: enabled,
          ):
              assert_equal(colors.format_msg(fmt), "abcde")
              assert_equal(
                  colors.format_msg(fmt, use_color=False), "abcde"
              )
  
      with patch(
          "datalad.support.ansi_colors.color_enabled", lambda: False
      ):
          for use_color in (True, False):
              assert_equal(colors.format_msg(fmt), "abcde")
              assert_equal(
                  colors.format_msg(fmt, use_color=use_color), "abcde"
              )
  
      with patch(
          "datalad.support.ansi_colors.color_enabled", lambda: True
      ):
          assert_equal(
              colors.format_msg(fmt, use_color=True),
              "a\033[1mb\033[0mc\033[1md\033[0me",
          )
  
imports: import os
  from unittest.mock import patch
  from datalad.support import ansi_colors
  from datalad.tests.utils_pytest import assert_equal, patch_config
label_desc: Use image node_id 2 for calling a global function with example usage: test_format_msg() without return types