input: Write a python function to implement the predict method for the DecisionTreeClassifier.
  assert model.predict([[5.1, 3.5, 1.4, 0.2]]) == [0]
  assert model.predict([[6.7, 3.1, 4.4, 1.4], [5.8, 2.7, 4.1, 1.0]]) == [1, 1]
  assert model.predict([[6.0, 2.2, 5.0, 1.5], [5.7, 2.8, 4.1, 1.3]]) == [2, 1]
output: def predict(self, X):
      def traverse_tree(x, node):
          if 'label' in node:
              return node['label']
          feature_index = node['feature_index']
          threshold = node['threshold']
          if x[feature_index] <= threshold:
              return traverse_tree(x, node['left'])
          else:
              return traverse_tree(x, node['right'])
      
      predictions = []
      for x in X:
          predictions.append(traverse_tree(x, self.tree_))
      
      return predictions