rewritted getGroups to py