def __call__(self, ds):
from . import globalipapp<EOL>pyps1 = '<STR_LIT>'<EOL>pyps2 = '<STR_LIT>'<EOL>pyout = '<STR_LIT>'<EOL>dnew = ds<EOL>dnew = self.rps1.sub(pyps1, dnew)<EOL>dnew = self.rps2.sub(pyps2, dnew)<EOL>dnew = self.rout.sub(pyout, dnew)<EOL>ip = globalipapp.get_ipython()<EOL>out = []<EOL>newline = out.append<EOL>for line in dnew.splitlines():<EOL><INDENT>mps1 = self.rpyps1.match(line)<EOL>if mps1 is not None:<EOL><INDENT>prompt, text = mps1.groups()<EOL>newline(prompt+ip.prefilter(text, False))<EOL>continue<EOL><DEDENT>mps2 = self.rpyps2.match(line)<EOL>if mps2 is not None:<EOL><INDENT>prompt, text = mps2.groups()<EOL>newline(prompt+ip.prefilter(text, True))<EOL>continue<EOL><DEDENT>newline(line)<EOL><DEDENT>newline('<STR_LIT>')  <EOL>return '<STR_LIT:\n>'.join(out)<EOL>
Convert IPython prompts to python ones in a string.