code: def supported(cls, stream=sys.stdout):
          
          if not stream.isatty():
              return False  # auto color only on TTYs
          try:
              import curses
          except ImportError:
              return False
          else:
              try:
                  try:
                      return curses.tigetnum("colors") > 2
                  except curses.error:
                      curses.setupterm()
                      return curses.tigetnum("colors") > 2
              except:
                  raise
                  # guess false in case of error
                  return False
docs: A class method that returns True if the current platform supports
          coloring terminal output using this method. Returns False otherwise.