input: Write a function to create an AI model in Python that classifies emails from the Enron Spam Dataset as either spam or non-spam. The function should load the dataset, preprocess the text data using a bag-of-words model, train an SVM classifier, and return the precision score of the model on the test data.
  assert classify_emails(pd.read_csv("spam.csv", encoding='iso-8859-1')) > 0.8
  assert classify_emails(pd.read_csv("spam.csv", encoding='iso-8859-1')) < 1.0
  assert classify_emails(pd.DataFrame({'EmailText': [], 'Label': []})) == 0.0
output: def classify_emails(df):
      if df.empty:
          return 0.0
      
      df['Label'] = df['Label'].map({'spam': 1, 'non-spam': 0})
      X = df['EmailText']
      y = df['Label']
      
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
      
      vectorizer = CountVectorizer()
      X_train_vec = vectorizer.fit_transform(X_train)
      X_test_vec = vectorizer.transform(X_test)
      
      svm = SVC(kernel='linear')
      svm.fit(X_train_vec, y_train)
      
      y_pred = svm.predict(X_test_vec)
      precision = precision_score(y_test, y_pred)
      
      return precision