
    Given a matrix of patient health indicators where each row represents an individual patient's vital signs and medical metrics, rearrange the patient records in ascending order based on their total risk score (calculated as the sum of their health indicators). This sorting will create a prioritized list of patients, from those with the lowest combined risk factors to those requiring immediate attention due to higher risk scores.
    

    
def sort_matrix(M):
    """
    Given a matrix of patient health indicators where each row represents an individual patient's vital signs and medical metrics, rearrange the patient records in ascending order based on their total risk score (calculated as the sum of their health indicators). This sorting will create a prioritized list of patients, from those with the lowest combined risk factors to those requiring immediate attention due to higher risk scores.
    

    """
def sort_matrix(M):
    """
    Given a matrix of patient health indicators where each row represents an individual patient's vital signs and medical metrics, rearrange the patient records in ascending order based on their total risk score (calculated as the sum of their health indicators). This sorting will create a prioritized list of patients, from those with the lowest combined risk factors to those requiring immediate attention due to higher risk scores.
    

    """
    result = sorted(M, key=sum)
    return result