def interact(banner=None, readfunc=None, my_locals=None, my_globals=None):
def console_runcode(code_obj):<EOL><INDENT>runcode(console, code_obj)<EOL><DEDENT>console = code.InteractiveConsole(my_locals, filename='<STR_LIT>')<EOL>console.runcode = console_runcode<EOL>setattr(console, '<STR_LIT>', my_globals)<EOL>if readfunc is not None:<EOL><INDENT>console.raw_input = readfunc<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>import readline<EOL><DEDENT>except ImportError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>console.interact(banner)<EOL>pass<EOL>
Almost a copy of code.interact
    Closely emulate the interactive Python interpreter.

    This is a backwards compatible interface to the InteractiveConsole
    class.  When readfunc is not specified, it attempts to import the
    readline module to enable GNU readline if it is available.

    Arguments (all optional, all default to None):

    banner -- passed to InteractiveConsole.interact()
    readfunc -- if not None, replaces InteractiveConsole.raw_input()
    local -- passed to InteractiveInterpreter.__init__()