Python implementation of "Measuring entropy/ information/ patterns of a 2d binary matrix" based on the corresponding StackOverflow answer