def determine_gov_opp(all_pairs):
    final_pairings = []
    for p in all_pairs:
        if tab_logic.num_govs(p[0]) < tab_logic.num_govs(p[1]): #p[0] should be gov
            final_pairings +=[[p[0],p[1]]]
        elif tab_logic.num_govs(p[1]) < tab_logic.num_govs(p[0]): #p[1] should be gov
            final_pairings +=[[p[1],p[0]]]
        elif tab_logic.num_opps(p[0]) < tab_logic.num_opps(p[1]): #p[1] should be gov
            final_pairings +=[[p[1],p[0]]]
        elif tab_logic.num_opps(p[1]) < tab_logic.num_opps(p[0]): #p[0] should be gov
            final_pairings +=[[p[0],p[1]]]
        elif random.randint(0,1) == 0:
            final_pairings +=[[p[0],p[1]]]
        else:
            final_pairings +=[[p[1],p[0]]]
    return final_pairings
dataset/ETHPy150Open jolynch/mit-tab/mittab/libs/pairing_alg.py/determine_gov_opp/original