input: Write a function to construct a decision tree algorithm for predicting the value of a stock based on a csv file containing stock data from the last 3 months. The function should load the data, split it into training and testing sets, train a decision tree classifier, and print the accuracy of the model.
  assert construct_decision_tree("stockdata.csv")=='Model accuracy: 0.85'
  assert construct_decision_tree("stockdata_new.csv")=='Model accuracy: 0.78'
  assert construct_decision_tree("stockdata_old.csv")=='Model accuracy: 0.90'
  assert construct_decision_tree("stockdata_empty.csv")=='Model accuracy: NaN'
  assert construct_decision_tree("stockdata_missing.csv")=='Model accuracy: NaN'
output: 
  def construct_decision_tree(filename):
      try:
          import pandas as pd
          from sklearn.model_selection import train_test_split
          from sklearn.tree import DecisionTreeClassifier
          from sklearn.metrics import accuracy_score
          
          data = pd.read_csv(filename)
          X = data.drop('target', axis=1)
          y = data['target']
          
          if X.empty or y.empty:
              return 'Model accuracy: NaN'
          
          X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
          
          clf = DecisionTreeClassifier()
          clf.fit(X_train, y_train)
          
          y_pred = clf.predict(X_test)
          accuracy = accuracy_score(y_test, y_pred)
          
          return f'Model accuracy: {accuracy:.2f}'
      except Exception:
          return 'Model accuracy: NaN'
  