code: def _classify(self, X, tree, proba=False):
          
  
          n_samples, n_features = X.shape
          predicted = np.ones(n_samples)
  
          # Check if final node
          if tree['split'] == -1:
              if not proba:
                  predicted = predicted * tree['y_pred']
              else:
                  predicted = predicted * tree['y_prob']
          else:
              j, l = tree['split']
              filter_Xl = (X[:, j] <= l)
              filter_Xr = ~filter_Xl
              n_samples_Xl = np.nonzero(filter_Xl)[0].shape[0]
              n_samples_Xr = np.nonzero(filter_Xr)[0].shape[0]
  
              if n_samples_Xl == 0:  # If left node is empty only continue with right
                  predicted[filter_Xr] = self._classify(X[filter_Xr, :], tree['sr'], proba)
              elif n_samples_Xr == 0:  # If right node is empty only continue with left
                  predicted[filter_Xl] = self._classify(X[filter_Xl, :], tree['sl'], proba)
              else:
                  predicted[filter_Xl] = self._classify(X[filter_Xl, :], tree['sl'], proba)
                  predicted[filter_Xr] = self._classify(X[filter_Xr, :], tree['sr'], proba)
  
          return predicted
docs: Private function that classify a dataset using tree.
  
          Parameters
          ----------
  
          X : array-like of shape = [n_samples, n_features]
              The input samples.
  
          tree : object
  
          proba : bool, optional (default=False)
              If True then return probabilities else return class
  
          Returns
          -------
          prediction : array of shape = [n_samples]
              If proba then return the predicted positive probabilities, else return
              the predicted class for each example in X