'A class method that returns True if the current platform supports
coloring terminal output using this method. Returns False otherwise.'

def supported(cls, stream=sys.stdout):

    if (not stream.isatty()):
        return False
    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:
            return False
