nodes: 0, module; 1, function_definition; 2, function_name:_get_sorted_relationships; 3, parameters; 4, block; 5, identifier:self; 6, identifier:goterm; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, comment:"""Traverse GO Terms above the current GO Term. Then add current GO Term to sorted."""; 13, comparison_operator:goterm.id in self.goids_seen; 14, block; 15, call; 16, identifier:goterm_upper; 17, call; 18, block; 19, call; 20, attribute; 21, attribute; 22, return_statement; 23, attribute; 24, argument_list; 25, attribute; 26, argument_list; 27, expression_statement; 28, attribute; 29, argument_list; 30, identifier:goterm; 31, identifier:id; 32, identifier:self; 33, identifier:goids_seen; 34, attribute; 35, identifier:add; 36, attribute; 37, identifier:goterm; 38, identifier:get_goterms_upper; 39, call; 40, attribute; 41, identifier:append; 42, identifier:goterm; 43, identifier:self; 44, identifier:goids_seen; 45, identifier:goterm; 46, identifier:id; 47, attribute; 48, argument_list; 49, identifier:self; 50, identifier:goterms_sorted; 51, identifier:self; 52, identifier:_get_sorted_relationships; 53, identifier:goterm_upper
code: 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)