def run_exec_lines(shell, exec_lines):
    """
    Partial copy of  run_exec_lines code from IPython.core.shellapp .
    """
    try:
        iter(exec_lines)
    except TypeError:
        pass
    else:
        try:
            for line in exec_lines:
                try:
                    shell.run_cell(line, store_history=False)
                except:
                    shell.showtraceback()
        except:
            shell.showtraceback()

    Partial copy of  run_exec_lines code from IPython.core.shellapp .
    
src/ptpython/ipython.py