I just noticed that there is a duplicate copy of this function in the `_pixelfunc` module. That's OK; we can fix that after merging your PR.