Stable Matching in Python