def colors(state):
	color = ''

	if (state == 'BLUE'):
		color = '\033[94m'

	if (state == 'GREEN'):
		color = '\033[92m'

	if (state == 'YELLOW'):
		color = '\033[93m'

	if (state == 'RED'):
		color = '\033[91m'

	if (state == 'ENDC'):
		color = '\033[0m'

	if (state == 'WHITE'):
		color = '\033[0m'

	return color

def log(string, color):
	print('\033[1m' + colors(color) + string + colors("ENDC"))

def seperator(color):
	print('\033[1m' + colors(color) + ("-" * 50) + colors("ENDC"))
import sys
import os

def colors(state):
	color = ''

	if (state == 'BLUE'):
		color = '\033[94m'

	if (state == 'GREEN'):
		color = '\033[92m'

	if (state == 'YELLOW'):
		color = '\033[93m'

	if (state == 'RED'):
		color = '\033[91m'

	if (state == 'ENDC'):
		color = '\033[0m'

	if (state == 'WHITE'):
		color = '\033[0m'

	return color

def supports_color():
    """
    from https://github.com/django/django/blob/master/django/core/management/color.py
    Return True if the running system's terminal supports color,
    and False otherwise.
    """

    plat = sys.platform
    supported_platform = plat != 'Pocket PC' and (plat != 'win32' or 'ANSICON' in os.environ)

    # isatty is not always implemented, #6223.
    is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
    if not supported_platform or not is_a_tty:
        return False
    return True

def log(string, color):
	if not supports_color():
		print(string)
	else:
		print('\033[1m' + colors(color) + string + colors("ENDC"))

def seperator(color):
	if not supports_color():
		print("-" * 50)
	else:
		print('\033[1m' + colors(color) + ("-" * 50) + colors("ENDC"))
Add proper logging support for consoles that don't accept ANSI
Add proper logging support for consoles that don't accept ANSI


+ import sys
+ import os
+ 
  def colors(state):
  	color = ''
  
  	if (state == 'BLUE'):
  		color = '\033[94m'
  
  	if (state == 'GREEN'):
  		color = '\033[92m'
  
  	if (state == 'YELLOW'):
  		color = '\033[93m'
  
  	if (state == 'RED'):
  		color = '\033[91m'
  
  	if (state == 'ENDC'):
  		color = '\033[0m'
  
  	if (state == 'WHITE'):
  		color = '\033[0m'
  
  	return color
  
+ def supports_color():
+     """
+     from https://github.com/django/django/blob/master/django/core/management/color.py
+     Return True if the running system's terminal supports color,
+     and False otherwise.
+     """
+ 
+     plat = sys.platform
+     supported_platform = plat != 'Pocket PC' and (plat != 'win32' or 'ANSICON' in os.environ)
+ 
+     # isatty is not always implemented, #6223.
+     is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
+     if not supported_platform or not is_a_tty:
+         return False
+     return True
+ 
  def log(string, color):
+ 	if not supports_color():
+ 		print(string)
+ 	else:
- 	print('\033[1m' + colors(color) + string + colors("ENDC"))
+ 		print('\033[1m' + colors(color) + string + colors("ENDC"))
  
  def seperator(color):
+ 	if not supports_color():
+ 		print("-" * 50)
+ 	else:
- 	print('\033[1m' + colors(color) + ("-" * 50) + colors("ENDC"))
+ 		print('\033[1m' + colors(color) + ("-" * 50) + colors("ENDC"))
Add proper logging support for consoles that don't accept ANSI
## Code Before:
def colors(state):
	color = ''

	if (state == 'BLUE'):
		color = '\033[94m'

	if (state == 'GREEN'):
		color = '\033[92m'

	if (state == 'YELLOW'):
		color = '\033[93m'

	if (state == 'RED'):
		color = '\033[91m'

	if (state == 'ENDC'):
		color = '\033[0m'

	if (state == 'WHITE'):
		color = '\033[0m'

	return color

def log(string, color):
	print('\033[1m' + colors(color) + string + colors("ENDC"))

def seperator(color):
	print('\033[1m' + colors(color) + ("-" * 50) + colors("ENDC"))
## Instruction:
Add proper logging support for consoles that don't accept ANSI
## Code After:
import sys
import os

def colors(state):
	color = ''

	if (state == 'BLUE'):
		color = '\033[94m'

	if (state == 'GREEN'):
		color = '\033[92m'

	if (state == 'YELLOW'):
		color = '\033[93m'

	if (state == 'RED'):
		color = '\033[91m'

	if (state == 'ENDC'):
		color = '\033[0m'

	if (state == 'WHITE'):
		color = '\033[0m'

	return color

def supports_color():
    """
    from https://github.com/django/django/blob/master/django/core/management/color.py
    Return True if the running system's terminal supports color,
    and False otherwise.
    """

    plat = sys.platform
    supported_platform = plat != 'Pocket PC' and (plat != 'win32' or 'ANSICON' in os.environ)

    # isatty is not always implemented, #6223.
    is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
    if not supported_platform or not is_a_tty:
        return False
    return True

def log(string, color):
	if not supports_color():
		print(string)
	else:
		print('\033[1m' + colors(color) + string + colors("ENDC"))

def seperator(color):
	if not supports_color():
		print("-" * 50)
	else:
		print('\033[1m' + colors(color) + ("-" * 50) + colors("ENDC"))