Postgresql Find Duplicate Rows In Python How To Sort