def auto():
try:<EOL><INDENT>Style.enabled = False<EOL>Style.enabled = sys.stdout.isatty()<EOL><DEDENT>except (AttributeError, TypeError):<EOL><INDENT>pass<EOL><DEDENT>
set colouring on if STDOUT is a terminal device, off otherwise