Powershell Group By Count Python Function