https://wikimass.com/python/matrix-transpose