def file_supports_color(file_obj):
plat = sys.platform<EOL>supported_platform = plat != '<STR_LIT>' and (plat != '<STR_LIT:win32>' or<EOL>'<STR_LIT>' in os.environ)<EOL>is_a_tty = file_is_a_tty(file_obj)<EOL>return (supported_platform and is_a_tty)<EOL>
Returns True if the running system's terminal supports color.

Borrowed from Django
https://github.com/django/django/blob/master/django/core/management/color.py