only strip continuation prompts if regular prompts seen first

should be discussed before merge (ping @takluyver),
as it is a significant and sensitive change.

I'm also not sure that it's the right fix, but worth a try.

closes #4059
adjust strip_prompts logic a bit further

- initial-only prompt is only stripped from the first line (only change from master)
- any prompt is stripped from the second line
- if a prompt is found in the first two lines,
  strip from the rest of the block
Fixed name error bug in function safe_unicode in module py3compat.
Merge pull request #4132 from rossant/py3compat-bug-fix

Fixed name error bug in function safe_unicode in module py3compat.
Merge pull request #4060 from minrk/multiprompt

only strip continuation prompts if regular prompts seen first
Merge branch 'master' of https://github.com/ipython/ipython into PDFfigures