If you know what you will decide based on the length of the tuple, then you can probably just hard-code your rules! Did the SQL version not work for you? Or are you just experimenting with decision trees?
You can of course use a decision tree. You data can be split based on the features you provide, so you can look at more than the length of the tuple e.g. look at the values of the
DestinationIP and your other variables in the tuple.
It could look something like this:
from sklearn import tree
from sklearn.model_selection import train_test_split
Create a train-test split from your data, assuming you have some input tuples and the response that you want to predict:
X = your_tuple_data
y = corresponding_responses_to_predict
# Split dataset into training set and test set
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1) # 70% training and 30% test
Create Decision Tree classifer object
clf = DecisionTreeClassifier()
# Train Decision Tree Classifer
clf = clf.fit(X_train,y_train)
Predict the response for test dataset
y_pred = clf.predict(X_test)
Have a look at the SciKit-Learn documentation for more information. Here is a tutorial with more ideas behind why this could work.