I would like to read the next *logical* line from a file into python, where logical means "according to the syntax of python".

I have written a small command which reads a set of statements from a file, and then prints out what you would get if you typed the statements into a python shell, complete with prompts and return values. Simple enough -- read each line, then eval. Which works just fine, until you hit a multi-line string.

I'm trying to avoid doing my own lexical analysis. 

As a simple example, say I have a file containing

```
2 + 2

```

I want to print

```
>>> 2 + 2
4

```

and if I have a file with 

```
"""Hello
World"""

```

I want to print

```
>>>> """Hello
...World"""
'Hello\nWorld'

```

The first of these is trivial -- read a line, eval, print. But then I need special support for comment lines. And now triple quotes. And so on.