code: def use_color(setting):
      
      if setting not in COLOR_CHOICES:
          raise InvalidColorSetting(setting)
  
      return (
          setting == 'always' or
          (setting == 'auto' and sys.stdout.isatty() and terminal_supports_color)
      )
docs: Choose whether to use color based on the command argument.
  
      Args:
          setting - Either `auto`, `always`, or `never`