Create an interactive session and execute the
    commands passed as "cmds" and return all output

    params:
      - cmds: a list of commands to run
    returns: (output, returned)

    The output contains both sys.stdout and sys.stderr logs

def autorun_get_interactive_session(cmds, **kargs):
    """Create an interactive session and execute the
    commands passed as "cmds" and return all output

    params:
      - cmds: a list of commands to run
    returns: (output, returned)

    The output contains both sys.stdout and sys.stderr logs"""
    sstdout, sstderr = sys.stdout, sys.stderr
    sw = StringWriter()
    try:
        try:
            sys.stdout = sys.stderr = sw
            res = autorun_commands(cmds, **kargs)
        except StopAutorun as e:
            e.code_run = sw.s
            raise
    finally:
        sys.stdout, sys.stderr = sstdout, sstderr
    return sw.s, res