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 data, train an SVM model, and calculate the precision score. If the dataset path is invalid, the function should return an error message.
  
  import pandas as pd
  from sklearn.feature_extraction.text import CountVectorizer
  from sklearn.model_selection import train_test_split
  from sklearn import svm
  from sklearn.metrics import precision_score
  
  def classify_spam(dataset_path):
      try:
          # Load the dataset
          df = pd.read_csv(dataset_path, encoding='iso-8859-1')
          # Load label and 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
          X_test_counts = count_vectorizer.transform(X_test)
          predictions = clf.predict(X_test_counts)
          score = precision_score(y_test, predictions, average='binary')
  
          return score
      except Exception as e:
          return str(e)
  
  assert abs(classify_spam("spam.csv") - 0.98) < 0.01
  assert classify_spam("invalid_path.csv") == "No such file or directory"
output: def classify_spam(dataset_path):
      try:
          # Load the dataset
          df = pd.read_csv(dataset_path, encoding='iso-8859-1')
          # Load label and 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
          X_test_counts = count_vectorizer.transform(X_test)
          predictions = clf.predict(X_test_counts)
          score = precision_score(y_test, predictions, average='binary')
  
          return score
      except Exception as e:
          return str(e)