How to rotate matrix clockwise?
Implement rotate_matrix(matrix) to rotate a square matrix 90 degrees clockwise in place and return the same matrix. The rotation must use O(1) auxiliary space, excluding the matrix itself. The input is a non-empty list of equal-length lists containing integers.
def rotate_matrix(matrix):