Python implementation of "Measuring entropy/ information/ patterns of a 2d binary matrix" from http://stats.stackexchange.com/a/17556/43909