def _npairs(n_items):
    """Return the number of pairs given n_items; corresponds to the length
    of a triu matrix (diagonal included)"""
    if n_items < 2:
        raise ValueError("More than two items required, "
                         "passed {0}".format(n_items))
    n_pairs = int(n_items * (n_items - 1) / 2. + n_items)
    return n_pairs