code: def style(
      text,
      fg=None,
      bg=None,
      bold=None,
      dim=None,
      underline=None,
      blink=None,
      reverse=None,
      reset=True,
  ):
      """Styles a text with ANSI styles and returns the new string.  By
      default the styling is self contained which means that at the end
      of the string a reset code is issued.  This can be prevented by
      passing ``reset=False``.
  
      Examples::
  
          click.echo(click.style('Hello World!', fg='green'))
          click.echo(click.style('ATTENTION!', blink=True))
          click.echo(click.style('Some things', reverse=True, fg='cyan'))
  
      Supported color names:
  
      * ``black`` (might be a gray)
      * ``red``
      * ``green``
      * ``yellow`` (might be an orange)
      * ``blue``
      * ``magenta``
      * ``cyan``
      * ``white`` (might be light gray)
      * ``bright_black``
      * ``bright_red``
      * ``bright_green``
      * ``bright_yellow``
      * ``bright_blue``
      * ``bright_magenta``
      * ``bright_cyan``
      * ``bright_white``
      * ``reset`` (reset the color code only)
  
      .. versionadded:: 2.0
  
      .. versionadded:: 7.0
         Added support for bright colors.
  
      :param text: the string to style with ansi codes.
      :param fg: if provided this will become the foreground color.
      :param bg: if provided this will become the background color.
      :param bold: if provided this will enable or disable bold mode.
      :param dim: if provided this will enable or disable dim mode.  This is
                  badly supported.
      :param underline: if provided this will enable or disable underline.
      :param blink: if provided this will enable or disable blinking.
      :param reverse: if provided this will enable or disable inverse
                      rendering (foreground becomes background and the
                      other way round).
      :param reset: by default a reset-all code is added at the end of the
                    string which means that styles do not carry over.  This
                    can be disabled to compose styles.
      """
      bits = []
      if fg:
          try:
              bits.append("\033[{}m".format(_ansi_colors[fg]))
          except KeyError:
              raise TypeError("Unknown color '{}'".format(fg))
      if bg:
          try:
              bits.append("\033[{}m".format(_ansi_colors[bg] + 10))
          except KeyError:
              raise TypeError("Unknown color '{}'".format(bg))
      if bold is not None:
          bits.append("\033[{}m".format(1 if bold else 22))
      if dim is not None:
          bits.append("\033[{}m".format(2 if dim else 22))
      if underline is not None:
          bits.append("\033[{}m".format(4 if underline else 24))
      if blink is not None:
          bits.append("\033[{}m".format(5 if blink else 25))
      if reverse is not None:
          bits.append("\033[{}m".format(7 if reverse else 27))
      bits.append(text)
      if reset:
          bits.append(_ansi_reset_all)
      return "".join(bits)
  
imports: import inspect
  import io
  import itertools
  import os
  import struct
  import sys
  from ._compat import DEFAULT_COLUMNS
  from ._compat import get_winterm_size
  from ._compat import isatty
  from ._compat import raw_input
  from ._compat import string_types
  from ._compat import strip_ansi
  from ._compat import text_type
  from ._compat import WIN
  from .exceptions import Abort
  from .exceptions import UsageError
  from .globals import resolve_color_default
  from .types import Choice
  from .types import convert_type
  from .types import Path
  from .utils import echo
  from .utils import LazyFile
label_desc: Use image node_id 10 for calling a global function with example usage: style(text, fg, bg, bold, dim, underline, blink, reverse, reset) and returns: str