code: def _get_sorted_relationships(self, goterm):
          
          if goterm.id in self.goids_seen:
              return
          self.goids_seen.add(goterm.id)
          for goterm_upper in goterm.get_goterms_upper():
              self._get_sorted_relationships(goterm_upper)
          self.goterms_sorted.append(goterm)
docs: Traverse GO Terms above the current GO Term. Then add current GO Term to sorted.