def sum_matrix(matrix):
    """gives sum of elements in a matrix.
    matrix = list of list of numbers"""
    ans = 0
    for rows in matrix:
        for el in rows:
            ans += el
    return ans
