input: Write a function to create a machine learning model in Python that predicts customer lifetime value given a customer's past transactions. If the function is provided with valid input data, it should return the predicted lifetime value. If the input data is not applicable, it should return None.
  import pandas as pd
  import numpy as np
  
  from sklearn.preprocessing import StandardScaler
  from sklearn.ensemble import RandomForestRegressor
  
  def predict_ltv(transactions_file, customer_input):
      # Preprocessing
      df = pd.read_csv(transactions_file)
      X = df.iloc[:,:-1].values
      y = df.iloc[:,-1].values
      scaler = StandardScaler()
      X = scaler.fit_transform(X)
  
      # Model Training
      model = RandomForestRegressor()
      model.fit(X, y)
  
      # Prediction
      if customer_input is not None:
          trans_scaled = scaler.transform(customer_input)
          predicted_LTV = model.predict(trans_scaled)[0]
          return predicted_LTV
      else:
          return None
  
  assert predict_ltv('transactions.csv', np.array([[10, 100, 5, ...]])) == SomeValue
  assert predict_ltv('transactions.csv', None) == None
output: 
  def predict_ltv(transactions_file, customer_input):
      # Preprocessing
      df = pd.read_csv(transactions_file)
      X = df.iloc[:,:-1].values
      y = df.iloc[:,-1].values
      scaler = StandardScaler()
      X = scaler.fit_transform(X)
  
      # Model Training
      model = RandomForestRegressor()
      model.fit(X, y)
  
      # Prediction
      if customer_input is not None:
          trans_scaled = scaler.transform(customer_input)
          predicted_LTV = model.predict(trans_scaled)[0]
          return predicted_LTV
      else:
          return None
  