def __fleiss_pi_linear__(dataset, **kwargs):
    "\n    Calculates Fleiss' :math:`\\pi` (or multi-:math:`\\pi`), originally proposed in\n    [Fleiss1971]_, and is equivalent to Siegel and Castellan's :math:`K`\n    [SiegelCastellan1988]_.  For 2 coders, this is equivalent to Scott's :math:`\\pi`\n    [Scott1955]_.\n    "
    metric_kwargs = dict(kwargs)
    metric_kwargs['return_parts'] = True
    return_parts = kwargs['return_parts']
    if (len(set([len(coder_segs.values()) for coder_segs in dataset.values()])) != 1):
        raise Exception('Unequal number of items contained.')
    (all_numerators, all_denominators, _, coders_boundaries) = __actual_agreement_linear__(dataset, **metric_kwargs)
    A_a = (Decimal(sum(all_numerators)) / sum(all_denominators))
    p_e_segs = list()
    for boundaries_info in coders_boundaries.values():
        for item in boundaries_info:
            (boundaries, total_boundaries) = item
            p_e_seg = (Decimal(boundaries) / total_boundaries)
            p_e_segs.append(p_e_seg)
    P_e_seg = (Decimal(sum(p_e_segs)) / len(p_e_segs))
    A_e = (P_e_seg ** 2)
    pi = ((A_a - A_e) / (Decimal('1') - A_e))
    if return_parts:
        return (A_a, A_e)
    else:
        return pi
Calculates Fleiss' :math:`\pi` (or multi-:math:`\pi`), originally proposed in
[Fleiss1971]_, and is equivalent to Siegel and Castellan's :math:`K`
[SiegelCastellan1988]_.  For 2 coders, this is equivalent to Scott's :math:`\pi`
[Scott1955]_.
def __fleiss_pi_linear__(dataset, **kwargs):
    "\n    Calculates Fleiss' :math:`\\pi` (or multi-:math:`\\pi`), originally proposed in\n    [Fleiss1971]_, and is equivalent to Siegel and Castellan's :math:`K`\n    [SiegelCastellan1988]_.  For 2 coders, this is equivalent to Scott's :math:`\\pi`\n    [Scott1955]_.\n    "
    metric_kwargs = dict(kwargs)
    metric_kwargs['return_parts'] = True
    return_parts = kwargs['return_parts']
    if (len(set([len(coder_segs.values()) for coder_segs in dataset.values()])) != 1):
        raise Exception('Unequal number of items contained.')
    (all_numerators, all_denominators, _, coders_boundaries) = __actual_agreement_linear__(dataset, **metric_kwargs)
    A_a = (Decimal(sum(all_numerators)) / sum(all_denominators))
    p_e_segs = list()
    for boundaries_info in coders_boundaries.values():
        for item in boundaries_info:
            (boundaries, total_boundaries) = item
            p_e_seg = (Decimal(boundaries) / total_boundaries)
            p_e_segs.append(p_e_seg)
    P_e_seg = (Decimal(sum(p_e_segs)) / len(p_e_segs))
    A_e = (P_e_seg ** 2)
    pi = ((A_a - A_e) / (Decimal('1') - A_e))
    if return_parts:
        return (A_a, A_e)
    else:
        return pi