Update pygments monkeypatch for compatibility with Pygments 2.0

Closes gh-6877
Add some explanation about the pygments monkeypatch
Merge pull request #6878 from takluyver/pygments-monkeypatch-fix

Update pygments monkeypatch for compatibility with Pygments 2.0