Set the process group associated with the terminal given by fd (an open file descriptor as returned by os.open()) to pg.
os.tcsetpgrp(fd, pg, /)