input: Write a function to create an AI model in Python to classify emails from the Enron Spam Dataset as either spam or non-spam. If the email is classified as spam, return 'spam'. If the email is classified as non-spam, return 'non-spam'. If the input dataset is empty or invalid, return None.
  
  def classify_emails(df):
      if df.empty or 'EmailText' not in df.columns or 'Label' not in df.columns:
          return None
  
      # Load data
      X = df['EmailText']
      y = df['Label']
  
      # Split data into train-test sets
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20, random_state=42)
  
      # Create bag of words model
      count_vectorizer = CountVectorizer()
      X_train_counts = count_vectorizer.fit_transform(X_train)
  
      # Train the model
      clf = svm.SVC(kernel='linear')
      clf.fit(X_train_counts, y_train)
  
      # Test the model
      def predict_email(email_text):
          X_test_counts = count_vectorizer.transform([email_text])
          prediction = clf.predict(X_test_counts)
          return 'spam' if prediction[0] == 'spam' else 'non-spam'
  
      return predict_email
  
  assert classify_emails(pd.DataFrame({'EmailText': [], 'Label': []})) == None
  assert classify_emails(pd.DataFrame({'EmailText': ['Buy now for a discount!'], 'Label': ['spam']}))('Buy now for a discount!') == 'spam'
  assert classify_emails(pd.DataFrame({'EmailText': ['Meeting at 3 PM.'], 'Label': ['non-spam']}))('Meeting at 3 PM.') == 'non-spam'
output: def classify_emails(df):
      if df.empty or 'EmailText' not in df.columns or 'Label' not in df.columns:
          return None
  
      # Load data
      X = df['EmailText']
      y = df['Label']
  
      # Split data into train-test sets
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.20, random_state=42)
  
      # Create bag of words model
      count_vectorizer = CountVectorizer()
      X_train_counts = count_vectorizer.fit_transform(X_train)
  
      # Train the model
      clf = svm.SVC(kernel='linear')
      clf.fit(X_train_counts, y_train)
  
      # Test the model
      def predict_email(email_text):
          X_test_counts = count_vectorizer.transform([email_text])
          prediction = clf.predict(X_test_counts)
          return 'spam' if prediction[0] == 'spam' else 'non-spam'
  
      return predict_email