
    Given a list of social connections where each connection is represented as a pair of user IDs, write a function that identifies and counts mutual relationships in the network. A mutual relationship exists when two users are connected in both directions, meaning if user A is connected to user B, user B is also connected to user A, and these bidirectional connections should only be counted once in the final tally.
    

    
def count_bidirectional(test_list):
    """
    Given a list of social connections where each connection is represented as a pair of user IDs, write a function that identifies and counts mutual relationships in the network. A mutual relationship exists when two users are connected in both directions, meaning if user A is connected to user B, user B is also connected to user A, and these bidirectional connections should only be counted once in the final tally.
    

    """
def count_bidirectional(test_list):
    """
    Given a list of social connections where each connection is represented as a pair of user IDs, write a function that identifies and counts mutual relationships in the network. A mutual relationship exists when two users are connected in both directions, meaning if user A is connected to user B, user B is also connected to user A, and these bidirectional connections should only be counted once in the final tally.
    

    """
    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