Thanks for all the reviews. I am amazed at my ability to introduce a bug
in 3 lines of code.

I forced-pushed a new version which includes the feedback and adds an
entry to whats_new.rst. Please review.