ipython/ipython — pull request #6295 by embray (2014-08-12 15:53:50+00:00)
Title: Improve input transformer formatting of cell magics

For internal use this doesn't much matter--the primary motivation behind this is conversion from the notebook format to plain Python modules. For example given a cell like:

```
%%timeit
1 + 1 == 2
2 + 2 == 4
```

currently this is converted to:

```
# In[1]:

get_ipython().run_cell_magic(u'timeit', u'', u'1 + 1 == 2\n2 + 2 == 4')
```

With this PR it would instead be converted to:

```
# In[1]:

get_ipython().run_cell_magic(u'timeit', u'', u"""\
1 + 1 == 2
2 + 2 == 4
""")
```

thus improving readability and hand-editability at a cost of only about 6 extra characters. There might still be some issues to work out here though. I'm not sure if escaping will be fully handled properly without a little more tweaking.