input: Write a function to classify emails from a CSV file as either spam or non-spam using a Support Vector Machine (SVM) model. The function should return the precision score of the model. If the CSV file is empty, the function should return 0.
  assert classify_emails("spam.csv") > 0.8
  assert classify_emails("spam.csv") < 1.0
  assert classify_emails("empty.csv") == 0
output: def classify_emails(csv_file):
      import pandas as pd
      from sklearn.model_selection import train_test_split
      from sklearn.feature_extraction.text import TfidfVectorizer
      from sklearn.svm import SVC
      from sklearn.metrics import precision_score
      
      try:
          df = pd.read_csv(csv_file)
          if df.empty:
              return 0
          
          df.columns = ['label', 'text']
          df['label'] = df['label'].map({'spam': 1, 'ham': 0})
          
          X_train, X_test, y_train, y_test = train_test_split(df['text'], df['label'], test_size=0.2, random_state=42)
          
          vectorizer = TfidfVectorizer()
          X_train = vectorizer.fit_transform(X_train)
          X_test = vectorizer.transform(X_test)
          
          svm = SVC(kernel='linear')
          svm.fit(X_train, y_train)
          
          y_pred = svm.predict(X_test)
          precision = precision_score(y_test, y_pred)
          
          return precision
      except Exception as e:
          return 0