Question: 
Write a function to sort a given matrix in ascending order according to the sum of its rows.


Model's Code:
def sort_matrix(matrix):
    return sorted(matrix, key=sum)



Sample Correct Code:
def sort_matrix(M):
    result = sorted(M, key=sum)
    return result


Asserts:
assert sort_matrix([[1, 2, 3], [2, 4, 5], [1, 1, 1]])==[[1, 1, 1], [1, 2, 3], [2, 4, 5]]
assert sort_matrix([[1, 2, 3], [-2, 4, -5], [1, -1, 1]])==[[-2, 4, -5], [1, -1, 1], [1, 2, 3]]
assert sort_matrix([[5,8,9],[6,4,3],[2,1,4]])==[[2, 1, 4], [6, 4, 3], [5, 8, 9]]


Tests:
Test 1 of 3: PASS
Test 2 of 3: PASS
Test 3 of 3: PASS

Test 12 of 974: 9/12 (75.0%): success