code: def sortby(self, ntd):
          if 'reldepth' in self.grprobj.gosubdag.prt_attr['flds']:
              return [ntd.NS, -1*ntd.dcnt, ntd.reldepth]
          else:
              return [ntd.NS, -1*ntd.dcnt, ntd.depth]