Replacement for @raoulb pr#914

See #914

ToDo:
- [x] tests
- [x] final rebase
Or we could just make it a class method. You'd have to call it to access it, and you wouldn't be able to document it, but you would at least be able to access it from outside eval (and potentially other things might want to access it directly).