<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_section_hdrgos(self, fout_txt, sortby=None, prt_section=True):
 """Write high GO IDs that are actually used to group current set of GO IDs."""

        sec2d_go = self.grprobj.get_sections_2d()    # lists of GO IDs
        sec2d_nt = self.get_sections_2dnt(sec2d_go)  # lists of GO Grouper namedtuples
        if sortby is None:
            sortby = self.fncsortnt
        with open(fout_txt, 'w') as prt:
            self.prt_ver(prt)
            prt.write("# GROUP NAME: {NAME}\n".format(NAME=self.grprobj.grpname))
            for section_name, nthdrgos_actual in sec2d_nt:
                if prt_section:
                    prt.write("# SECTION: {SECTION}\n".format(SECTION=section_name))
                self.prt_ntgos(prt, nthdrgos_actual)
                if prt_section:
                    prt.write("\n")
            dat = SummarySec2dHdrGos().summarize_sec2hdrgos(sec2d_go)
            sys.stdout.write(self.grprobj.fmtsum.format(
                GO_DESC='hdr', SECs=len(dat['S']), GOs=len(dat['G']),
                UNGRP=len(dat['U']), undesc="unused",
                ACTION="WROTE:", FILE=fout_txt))
        return sec2d_nt