
    Given a list of client investment preference tuples where each tuple contains a risk tolerance level and corresponding investment strategy, write a function to count unique portfolio matching pairs while treating bidirectional relationships as equivalent (e.g., (conservative, bonds) and (bonds, conservative) count as one pair). The function should help financial advisors understand the distribution of client risk-strategy alignments while avoiding duplicate counts of the same relationship.
    

    
def count_bidirectional(test_list):
    """
    Given a list of client investment preference tuples where each tuple contains a risk tolerance level and corresponding investment strategy, write a function to count unique portfolio matching pairs while treating bidirectional relationships as equivalent (e.g., (conservative, bonds) and (bonds, conservative) count as one pair). The function should help financial advisors understand the distribution of client risk-strategy alignments while avoiding duplicate counts of the same relationship.
    

    """
def count_bidirectional(test_list):
    """
    Given a list of client investment preference tuples where each tuple contains a risk tolerance level and corresponding investment strategy, write a function to count unique portfolio matching pairs while treating bidirectional relationships as equivalent (e.g., (conservative, bonds) and (bonds, conservative) count as one pair). The function should help financial advisors understand the distribution of client risk-strategy alignments while avoiding duplicate counts of the same relationship.
    

    """
    res = 0
    for idx in range(0, len(test_list)):
        for iidx in range(idx + 1, len(test_list)):
            if test_list[iidx][0] == test_list[idx][1] and test_list[idx][1] == test_list[iidx][0]:
                res += 1
    return res