def is_terminal():
try:<EOL><INDENT>ip = get_ipython()<EOL><DEDENT>except NameError:  <EOL><INDENT>return True<EOL><DEDENT>else:<EOL><INDENT>if hasattr(ip, '<STR_LIT>'):  <EOL><INDENT>return False<EOL><DEDENT>else:  <EOL><INDENT>return True<EOL><DEDENT><DEDENT>
Detect if Python is running in a terminal.

Returns True if Python is running in a terminal or False if not.