input: Write a function to construct a naive bayes classifier in Python to classify emails as spam or not spam. The function should train the classifier on a given training dataset and return the trained model. The function should also provide a way to predict whether a new email is spam or not.
  assert model.fit(X_train, y_train) == model
  assert model.predict([new_email_features]) == [spam_or_not_spam]
  where X_train and y_train are the training data, new_email_features are the features of a new email, and spam_or_not_spam is the prediction result (either "spam" or "not spam").
output: def naive_bayes_classifier():
      from sklearn.naive_bayes import MultinomialNB
      from sklearn.feature_extraction.text import CountVectorizer
      from sklearn.pipeline import make_pipeline
      
      def train_and_predict(X_train, y_train):
          model = make_pipeline(CountVectorizer(), MultinomialNB())
          model.fit(X_train, y_train)
          return model
      
      return train_and_predict