def linkCount(tupleOfLists, listNumber, lowerBound, upperBound):
    """Counts the number of links in one of the lists passed.

    This function is a speciality function to aid in calculating
    statistics involving the number of links that lie in a given
    range. It is primarily intended as a private helper function. The
    parameters are:
    tupleOfLists -- usually a linkograph entry.
    listNumber -- a list of the indicies in entry that should be
                  considered.
    lowerBound -- the lowest index that should be considered.
    upperBound -- the highest index that should be considered.

    Example: a typical tupleOfLists is ({'A', 'B'}, {1,2}, {4,5}) a
    listNumber of [1] would only consider the links in {1,2}, a
    listNumber of [2] would only consider the links in {4,5} and a
    listNumber of [1,2] would consider the links in both {1,2}, and
    {4,5}.

    """

    summation = 0

    for index in listNumber:
        summation += len({link for link in tupleOfLists[index]
                          if link >= lowerBound
                          and link <= upperBound})

    return summation