def perfect_pairing(list_of_teams):
    """ Uses the mwmatching library to assign teams in a pairing """
    graph_edges = []
    for i in range(len(list_of_teams)):
        for j in range(len(list_of_teams)):
        # may want to change actual penalties
        # a team should not have an edge back to itself
        # nor do we need to calculate an edge from a to b and b to a
            if i > j:
                wt = calc_weight(list_of_teams[i],
                                 list_of_teams[j], i, j,
                                 list_of_teams[len(list_of_teams) - i - 1],
                                 list_of_teams[len(list_of_teams) - j - 1],
                                 len(list_of_teams) - 1 - i,
                                 len(list_of_teams) - j - 1)
                # Add the edge to the graph
                graph_edges += [(i,j,wt)]
    pairings_num = mwmatching.maxWeightMatching(graph_edges, maxcardinality=True)
    #print "Pairing numbers"
    #print pairings_num
    all_pairs = []
    for pair in pairings_num:
        if pair < len(list_of_teams):
            if [list_of_teams[pairings_num.index(pair)], list_of_teams[pair]] not in all_pairs and [list_of_teams[pair], list_of_teams[pairings_num.index(pair)]] not in all_pairs:
                all_pairs +=[[list_of_teams[pairings_num.index(pair)], list_of_teams[pair]]]
                #print "all pairs"
                #print all_pairs
    #print all_pairs
    return determine_gov_opp(all_pairs)

#Determine the weight of the pairing between teamA and teamB, i.e. how bad it is
#teamA_opt is the optimal team for teamA to be paired with
#teamB_opt is the optimal team for teamB to be paired with
dataset/ETHPy150Open jolynch/mit-tab/mittab/libs/pairing_alg.py/perfect_pairing/swapped operands of `-`