I am glad we have a test against MNE' C code otherwise I'd need 1 hour to answer this code. It's a bit of black magic :)