code: def colored(msg, color=None, background=None, style=None, force=False):
      
      try:
          if not force and not os.isatty(sys.stdout.fileno()):
              return msg
      except:
          return msg
  
      color = colors.get(color, colors["default"])
      background = backgrounds.get(background, backgrounds["default"])
  
      if not isinstance(style, (tuple, list, set)):
          style = (style,)
      style = ";".join(str(styles.get(s, styles["default"])) for s in style)
  
      return "\033[{};{};{}m{}\033[0m".format(style, background, color, msg)
docs: Return the colored version of a string *msg*. For *color*, *background* and *style* options, see
      https://misc.flogisoft.com/bash/tip_colors_and_formatting. Unless *force* is *True*, the *msg*
      string is returned unchanged in case the output is not a tty.