<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wr_txt_grouping_gos(self):
 """Write one file per GO group."""

        prt_goids = self.grprobj.gosubdag.prt_goids
        for hdrgo, usrgos in self.grprobj.hdrgo2usrgos.items():
            keygos = usrgos.union([hdrgo])
            fout_txt = "{BASE}.txt".format(BASE=self.grprobj.get_fout_base(hdrgo))
            with open(fout_txt, 'w') as prt:
                prt_goids(keygos, prt=prt)
                sys.stdout.write("  {N:5,} GO IDs WROTE: {TXT}\n".format(
                    N=len(keygos), TXT=fout_txt))