input: Write a python function to train and evaluate a Support Vector Machine (SVM) classifier on a given dataset of messages and labels.
  assert train_and_evaluate_svm(data) contains "accuracy"
  assert train_and_evaluate_svm(data).count("precision") == 2
  assert "spam" in train_and_evaluate_svm(data)
output: def train_and_evaluate_svm(data):
      from sklearn.feature_extraction.text import TfidfVectorizer
      from sklearn.svm import SVC
      from sklearn.model_selection import train_test_split
      from sklearn.metrics import classification_report, accuracy_score
      
      messages, labels = zip(*data)
      
      # Split data into training and testing sets
      X_train, X_test, y_train, y_test = train_test_split(messages, labels, test_size=0.2, random_state=42)
      
      # Vectorize text data
      vectorizer = TfidfVectorizer()
      X_train_vec = vectorizer.fit_transform(X_train)
      X_test_vec = vectorizer.transform(X_test)
      
      # Train SVM classifier
      svm = SVC(kernel='linear', random_state=42)
      svm.fit(X_train_vec, y_train)
      
      # Make predictions
      y_pred = svm.predict(X_test_vec)
      
      # Evaluate the classifier
      accuracy = accuracy_score(y_test, y_pred)
      report = classification_report(y_test, y_pred, target_names=['ham', 'spam'])
      
      return f"accuracy: {accuracy}\n{report}"