import curses


def has_colours(stream):
    """Determine if an output stream supports colours.

    Args:
        stream: the output stream to check

    Returns:
        True if more than 2 colours are supported; else False
    """
    if hasattr(stream, 'isatty') and stream.isatty():
        try:
            curses.setupterm()
            return curses.tigetnum('colors') > 2
        except Exception:
            pass
    return False