Python match/merge code for SNAC