Pythonic implementation of MATLAB's kstest2