input: Write a Python function to preprocess the dataset by encoding the target variable and splitting the data into train and test sets.
  assert len(train_test_split(pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'Attrition': ['Yes', 'No', 'Yes']}), 'Attrition', 0.2)) == 4
  assert all(isinstance(x, pd.DataFrame) or isinstance(x, pd.Series) for x in train_test_split(pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'Attrition': ['Yes', 'No', 'Yes']}), 'Attrition', 0.2))
output: from sklearn.model_selection import train_test_split
  from sklearn.preprocessing import LabelEncoder
  import pandas as pd
  
  def preprocess_dataset(df, target_column, test_size):
      le = LabelEncoder()
      df[target_column] = le.fit_transform(df[target_column])
      X = df.drop(columns=[target_column])
      y = df[target_column]
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=test_size, random_state=42)
      return X_train, X_test, y_train, y_test