'content is a list of strings. it is unedited directive conent
This runs it line by line in the InteractiveShell, prepends
prompts as needed capturing stderr and stdout, then returns
the content as a list as if it were ipython code'

def process_pure_python(self, content):

    output = []
    savefig = False
    multiline = False
    fmtin = self.promptin
    for (lineno, line) in enumerate(content):
        line_stripped = line.strip()
        if (not len(line)):
            output.append(line)
            continue
        if line_stripped.startswith('@'):
            output.extend([line])
            if ('savefig' in line):
                savefig = True
            continue
        if line_stripped.startswith('#'):
            output.extend([line])
            continue
        if (not multiline):
            if line_stripped.endswith('\\'):
                multiline = True
                cont_len = (len(str(lineno)) + 2)
                line_to_process = line.strip('\\')
                output.extend([(u'%s    %s' % ((fmtin % lineno), line))])
                continue
            else:
                line_to_process = line.strip('\\')
        else:
            line_to_process += line.strip('\\')
            if line_stripped.endswith('\\'):
                continuation = ('.' * cont_len)
                output.extend([((u'            %s:    ' + line_stripped) % continuation)])
                continue
        self.process_input_line(unicode(line_to_process.strip()), store_history=False)
        out_line = self.cout.getvalue()
        self.clear_cout()
        if savefig:
            self.ensure_pyplot()
            self.process_input_line('plt.clf()', store_history=False)
            self.clear_cout()
            savefig = False
        if (not multiline):
            in_line = (u'%s    %s' % ((fmtin % lineno), line))
            output.extend([in_line])
        else:
            output.extend([((u'            %s:    ' + line_stripped) % continuation)])
            multiline = False
        if len(out_line):
            output.extend([out_line])
        output.extend([u''])
    return output
