input: Write a python function to create and train an LSTM model on time series data. 
  assert lstm_model(np.array([[0.1], [0.2], [0.3]])) is not None
  assert lstm_model(np.array([[0.5], [0.6], [0.7], [0.8]])) is not None
  assert lstm_model(np.array([[1.0], [0.9], [0.8], [0.7], [0.6]])) is not None
output: def lstm_model(data):
      import numpy as np
      from tensorflow.keras.models import Sequential
      from tensorflow.keras.layers import LSTM, Dense
      from sklearn.preprocessing import MinMaxScaler
  
      # Ensure data is 2D
      if len(data.shape) == 1:
          data = data.reshape(-1, 1)
  
      # Scale data
      scaler = MinMaxScaler(feature_range=(0, 1))
      scaled_data = scaler.fit_transform(data)
  
      # Create sequences of data
      def create_sequences(data, seq_length):
          X, y = [], []
          for i in range(len(data) - seq_length):
              X.append(data[i:i+seq_length])
              y.append(data[i+seq_length])
          return np.array(X), np.array(y)
  
      seq_length = 1  # Example sequence length
      X, y = create_sequences(scaled_data, seq_length)
  
      # Reshape input to be [samples, time steps, features]
      X = X.reshape((X.shape[0], X.shape[1], 1))
  
      # Define LSTM model
      model = Sequential()
      model.add(LSTM(50, activation='relu', input_shape=(seq_length, 1)))
      model.add(Dense(1))
      model.compile(optimizer='adam', loss='mse')
  
      # Fit model
      model.fit(X, y, epochs=1, verbose=0)
  
      return model