def in_interactive_session():
 def check_main():
  import __main__ as main
  return ((not hasattr(main, '__file__')) or get_option('mode.sim_interactive'))
 try:
  return (__IPYTHON__ or check_main())
 except:
  return check_main()

def in_interactive_session ( ) : def check_main ( ) : import __main__ as main return ( ( not hasattr ( main , '__file__' ) ) or get_option ( 'mode.sim_interactive' ) ) try : return ( __IPYTHON__ or check_main ( ) ) except : return check_main ( )
check if were running in an interactive shell returns true if running under python/ipython interactive shell .