EMD implemented in Python