input: 
  def predict_ltv_python():
      """
      Create a machine learning model in Python that predicts customer lifetime value given a customer's past transactions.
      """
  
output:     
      import pandas as pd
      from sklearn.model_selection import train_test_split
      from sklearn.ensemble import RandomForestRegressor
      from sklearn.metrics import mean_squared_error
  
      # Sample data
      data = {
          'customer_id': [1, 2, 3, 4, 5],
          'transaction_amount': [100, 200, 150, 300, 250],
          'transaction_count': [5, 10, 7, 12, 9],
          'ltv': [500, 1000, 750, 1500, 1250]
      }
  
      df = pd.DataFrame(data)
  
      # Features and target
      X = df[['transaction_amount', 'transaction_count']]
      y = df['ltv']
  
      # Split data into training and testing sets
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
  
      # Train the model
      model = RandomForestRegressor(n_estimators=100, random_state=42)
      model.fit(X_train, y_train)
  
      # Predict on test data
      y_pred = model.predict(X_test)
  
      # Evaluate the model
      mse = mean_squared_error(y_test, y_pred)
      print(f'Mean Squared Error: {mse}')
  