How to use python's built in function to get matches filtered based on the similarity of the entities