input: Write a function to perform a simple linear regression using Python. The function should take a CSV file name as input, read the data, train a linear regression model, make predictions, and visualize the results. The function should return the trained model.
  assert linear_regression("data.csv")
  assert another_test_case("another_data.csv")
  assert yet_another_test("yet_another_data.csv")
output: import pandas as pd
  import numpy as np
  from sklearn.linear_model import LinearRegression
  import matplotlib.pyplot as plt
  
  def linear_regression(csv_file):
      data = pd.read_csv(csv_file)
      X = data.iloc[:, :-1].values
      y = data.iloc[:, -1].values
      model = LinearRegression()
      model.fit(X, y)
      y_pred = model.predict(X)
      plt.scatter(X, y, color='blue')
      plt.plot(X, y_pred, color='red')
      plt.show()
      return model