Traverse GO Terms above the current GO Term. Then add current GO Term to sorted.

def _get_sorted_relationships(self, goterm):
        """Traverse GO Terms above the current GO Term. Then add current GO Term to sorted."""
        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)