def METHOD_NAME(feature_name, data, label, class_list):
    feature_value_count_dict = data[feature_name].value_counts(sort=False) 
    tree = {} 
    for feature_value, count in feature_value_count_dict.iteritems():
        feature_value_data = data[data[feature_name] == feature_value] 
        assigned_to_node = False 
        for c in class_list: 
            class_count = feature_value_data[feature_value_data[label] == c].shape[0] 
            if class_count == count:
                tree[feature_value] = c 
                data = data[data[feature_name] != feature_value] 
                assigned_to_node = True
        if not assigned_to_node: 
            tree[feature_value] = "?"
    return tree, data