def rowswap(matlist, index1, index2, K):
    """
    Returns the matrix with index1 row and index2 row swapped
    """
    matlist[index1], matlist[index2] = matlist[index2], matlist[index1]
    return matlist