Nice. the `y.data.dtype.kind == 'O'` check is non trivial so this code should be included with a comment to explain that this adds support for the DOK and LIL sparse matrix datastructures.