def METHOD_NAME(msg: str, *attr: Union['stem.util.term.Color', 'stem.util.term.BgColor', 'stem.util.term.Attr']) -> str:
  """
  Simple terminal text formatting using `ANSI escape sequences
  <https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_codes>`_.
  The following are some toolkits providing similar capabilities:
  * `django.utils.termcolors <https://github.com/django/django/blob/master/django/utils/termcolors.py>`_
  * `termcolor <https://pypi.org/project/termcolor/>`_
  * `colorama <https://pypi.org/project/colorama/>`_
  .. versionchanged:: 1.6.0
     Normalized return value to be unicode to better support python 2/3
     compatibility.
  :param msg: string to be formatted
  :param attr: text attributes, this can be :data:`~stem.util.term.Color`,
    :data:`~stem.util.term.BgColor`, or :data:`~stem.util.term.Attr` enums
    and are case insensitive (so strings like 'red' are fine)
  :returns: **str** wrapped with ANSI escape encodings, starting with the given
    attributes and ending with a reset
  """
  msg = stem.util.str_tools._to_unicode(msg)
  attr = list(attr)
  if DISABLE_COLOR_SUPPORT:
    return msg
  if Attr.LINES in attr:
    attr.remove(Attr.LINES)
    lines = [METHOD_NAME(line, *attr) for line in msg.split('\n')]
    return '\n'.join(lines)
  # if we have reset sequences in the message then apply our attributes
  # after each of them
  if RESET in msg:
    return ''.join([METHOD_NAME(comp, *attr) for comp in msg.split(RESET)])
  prefix, suffix = encoding(*attr), RESET
  if prefix:
    if Attr.READLINE_ESCAPE in attr:
      prefix = '\001%s\002' % prefix
      suffix = '\001%s\002' % suffix
    return prefix + msg + suffix
  else:
    return msg