code: def file_supports_color(file_obj):
      
      plat = sys.platform
      supported_platform = plat != 'Pocket PC' and (plat != 'win32' or
                                                    'ANSICON' in os.environ)
  
      is_a_tty = hasattr(file_obj, 'isatty') and file_obj.isatty()
      if not supported_platform or not is_a_tty:
          return False
      return True
docs: Returns True if the running system's terminal supports color, and False
      otherwise.
  
      Borrowed from Django
      https://github.com/django/django/blob/master/django/core/management/color.py