input: Write a Python function to split the dataset into training and testing sets, train a DecisionTreeClassifier, and return the accuracy.
  assert round(train_and_evaluate('data.csv', 0.4, 42), 2) == 0.85
  assert round(train_and_evaluate('data.csv', 0.3, 42), 2) == 0.87
  assert round(train_and_evaluate('data.csv', 0.5, 42), 2) == 0.83
output: def train_and_evaluate(filename, test_size, random_state):
      import pandas as pd
      from sklearn.model_selection import train_test_split
      from sklearn.tree import DecisionTreeClassifier
      from sklearn.metrics import accuracy_score
      
      # Load the dataset
      data = pd.read_csv(filename)
      
      # Assuming the last column is the target variable
      X = data.iloc[:, :-1]
      y = data.iloc[:, -1]
      
      # Split the dataset into training and testing sets
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=test_size, random_state=random_state)
      
      # Train the DecisionTreeClassifier
      clf = DecisionTreeClassifier(random_state=random_state)
      clf.fit(X_train, y_train)
      
      # Predict on the test set
      y_pred = clf.predict(X_test)
      
      # Calculate the accuracy
      accuracy = accuracy_score(y_test, y_pred)
      
      return accuracy