input: Write a function to create and visualize a simple linear regression model in Python by reading input data from a CSV file. The function should return the trained model and display a scatter plot of the actual data points with the regression line. If the input file is empty or does not exist, the function should return None.
  assert linear_regression_model('data.csv') != None
  assert linear_regression_model('empty.csv') == None
  assert linear_regression_model('nonexistent.csv') == None
output: import pandas as pd
  import matplotlib.pyplot as plt
  from sklearn.linear_model import LinearRegression
  
  def linear_regression_model(filename):
      try:
          data = pd.read_csv(filename)
          if data.empty:
              return None
          X = data.iloc[:, 0].values.reshape(-1, 1)
          y = data.iloc[:, 1].values
          model = LinearRegression().fit(X, y)
          plt.scatter(X, y, color='blue')
          plt.plot(X, model.predict(X), color='red')
          plt.show()
          return model
      except FileNotFoundError:
          return None