human
Complete the below
def in_interactive_session():

    ''''check if we\'re running in an interactive shell
    returns True if running under python/ipython interactive shell'
    '''
 ... Write me a the Python code you requested?
assistant
#Here is the Python code you requested.
    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()