def square_matrix(X):
    """Squares a matrix"""
    result = [[(0.0) for x in range(len(X))] for y in range(len(X))]
    for i in range(len(X)):
        for j in range(len(X)):
            for k in range(len(X)):
                result[i][j] += X[i][k] * X[k][j]
    return result
