input: Write a python function to train a logistic regression model using TF-IDF vectorization on given text data and evaluate its accuracy.
  assert train_and_evaluate_model(["I'm feeling happy today", "I'm feeling very frustrated", "I'm not sure how to feel right now"], [1,0,2]) >= 0.5
  assert train_and_evaluate_model(["I love this!", "I hate this!", "It's okay, I guess"], [1,0,2]) >= 0.5
output: def train_and_evaluate_model(text_data, labels):
      from sklearn.feature_extraction.text import TfidfVectorizer
      from sklearn.linear_model import LogisticRegression
      from sklearn.model_selection import train_test_split
      from sklearn.metrics import accuracy_score
      
      # Split the data into training and testing sets
      X_train, X_test, y_train, y_test = train_test_split(text_data, labels, test_size=0.2, random_state=42)
      
      # Create TF-IDF vectorizer and transform the text data
      vectorizer = TfidfVectorizer()
      X_train_tfidf = vectorizer.fit_transform(X_train)
      X_test_tfidf = vectorizer.transform(X_test)
      
      # Train the logistic regression model
      model = LogisticRegression()
      model.fit(X_train_tfidf, y_train)
      
      # Predict on the test set
      y_pred = model.predict(X_test_tfidf)
      
      # Calculate the accuracy
      accuracy = accuracy_score(y_test, y_pred)
      
      return accuracy