sort results if parameter 'sort' is True in uniq