input: Write a python function to create a spam classifier using Naive Bayes and calculate its accuracy.
  assert spam_classifier(['this is not spam', 'hello friend', 'win money now']) > 0.5
  assert spam_classifier(['buy now', 'limited offer', 'congratulations you won']) > 0.7
  assert spam_classifier(['meeting at 5pm', 'your appointment is confirmed', 're: your request']) > 0.5
output: def spam_classifier(messages):
      from sklearn.feature_extraction.text import CountVectorizer
      from sklearn.naive_bayes import MultinomialNB
      from sklearn.model_selection import train_test_split
      from sklearn.metrics import accuracy_score
      
      # Sample data
      data = [
          ("this is not spam", 0),
          ("hello friend", 0),
          ("win money now", 1),
          ("buy now", 1),
          ("limited offer", 1),
          ("congratulations you won", 1),
          ("meeting at 5pm", 0),
          ("your appointment is confirmed", 0),
          ("re: your request", 0)
      ]
      
      # Splitting data into features and labels
      texts, labels = zip(*data)
      
      # Convert text data to numerical data
      vectorizer = CountVectorizer()
      X = vectorizer.fit_transform(texts)
      y = labels
      
      # Split data into training and testing sets
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)
      
      # Train Naive Bayes classifier
      classifier = MultinomialNB()
      classifier.fit(X_train, y_train)
      
      # Predict on test set
      y_pred = classifier.predict(X_test)
      
      # Calculate accuracy
      accuracy = accuracy_score(y_test, y_pred)
      
      # Transform input messages to same vector space
      input_messages = vectorizer.transform(messages)
      
      # Predict and return the accuracy of the input messages
      input_predictions = classifier.predict(input_messages)
      return accuracy