Fix %bookmark -l for Python 3

Closes gh-5676

Also add a simple test for %bookmark
Merge pull request #5677 from takluyver/i5676

Fix %bookmark -l for Python 3