def tree_gini_index(Y_left, Y_right, classes):
    """Compute the Gini Index.
    # Arguments
        Y_left: class labels of the data left set
            np.array of size `(n_objects, 1)`
        Y_right: class labels of the data right set
            np.array of size `(n_objects, 1)`
        classes: list of all class values
    # Output
        gini: scalar `float`
    """
    gini = 0
    all_inst = len(Y_left)+len(Y_right)

    gini += (len(Y_left)/all_inst)*(1-((len(Y_left[Y_left == classes[0]])/len(Y_left))**2 + 
                                       (len(Y_left[Y_left == classes[1]])/len(Y_left))**2))
    gini += (len(Y_right)/all_inst)*(1-((len(Y_right[Y_right == classes[0]])/len(Y_right))**2 + 
                                       (len(Y_right[Y_right == classes[1]])/len(Y_right))**2))
    
    return gini