def tuple_similarity(t1, t2, var_attr, cat_sim, num_dis_norm, agg_col):
    """Compute the similarity between two tuples t1 and t2 on their attributes var_attr

    Args:
        t1, t2: two tuples
        var_attr: variable attributes
        cat_sim: the similarity measure for categorical attributes
        num_dis_norm: normalization terms for numerical attributes
        agg_col: the column of aggregated value
    Returns:
        the Gower similarity between t1 and t2
    """
    sim = 0.0
    cnt = 0
    for col in var_attr:
        if t1[col] is None or t2[col] is None:
            continue
        if cat_sim.is_categorical(col):
            s = cat_sim.compute_similarity(col, t1[col], t2[col], agg_col)
            sim += s
        elif col != agg_col and col != 'index':
            temp = abs(t1[col] - t2[col]) / num_dis_norm[col]['range']
            sim += 1 - temp
        cnt += 1
    return sim / cnt
