<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_nts(self, goids=None, sortby=None):
 """Given GO IDs, get a list of namedtuples."""

        nts = []
        # User GO IDs
        if goids is None:
            goids = self.go_sources
        else:
            chk_goids(goids, "GoSubDag::get_nts")
        if goids:
            ntobj = cx.namedtuple("NtGo", " ".join(self.prt_attr['flds']))
            go2nt = self.get_go2nt(goids)
            for goid, ntgo in self._get_sorted_go2nt(go2nt, sortby):
                assert ntgo is not None, "{GO} NOT IN go2nt".format(GO=goid)
                if goid == ntgo.GO:
                    nts.append(ntgo)
                else:
                    fld2vals = ntgo._asdict()
                    fld2vals['GO'] = goid
                    nts.append(ntobj(**fld2vals))
        return nts