Select groups using python

Hello, after doing some Python scripts for DG 22 and 23, I tried to create a script to select groups but I could not find on the documentation how to do it. Is it possible? 

I appreciate any help.