human
Complete the below
def init_python_session():

    ''''Construct new Python session.'
    '''
 Give me a the Python code you requested?
assistant
#Here is the Python code you requested.
    from code import InteractiveConsole
    class SymPyConsole(InteractiveConsole, ):
        'An    interactive    console    with    readline    support.    '
        def __init__(self):
            InteractiveConsole.__init__(self)
            try:
                import readline
            except ImportError:
                pass
            else:
                import os
                import atexit
                readline.parse_and_bind('tab:    complete')
                if hasattr(readline, 'read_history_file'):
                    history = os.path.expanduser('~/.sympy-history')
                    try:
                        readline.read_history_file(history)
                    except IOError:
                        pass
                    atexit.register(readline.write_history_file, history)
    return SymPyConsole()