def getChanceAgreement(l1, l2):
    """
    Returns p_e, the probability of chance agreement: (1/N^2) * sum(n_k1 * n_k2) for rater1, rater2, k categories (i.e. two in this case, 0 or 1), for two binary lists L1 and L2
    """
    assert(len(l1) == len(l2))
    summation = 0
    for label in [0, 1]:
        summation += l1.count(label) * l2.count(label)
    return (1 / float(len(l1)**2)) * summation