Code from Alex Brainman, split out of another change. I changed it to a comma-ok return and tweaked the docs a bit.