nodes: 0, module; 1, function_definition; 2, function_name:most_frequent_terms; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, comment:# sort terms by number of occurrences in descending order; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, identifier:count; 13, integer:0; 14, comment:"""
          Returns ``count`` of terms sorted by their frequency
          in descending order.
  
          :parameter int count:
              Max. number of returned terms. Value 0 means no limit (default).
          """; 15, assignment; 16, assignment; 17, comparison_operator:count == 0; 18, block; 19, elif_clause; 20, else_clause; 21, identifier:terms; 22, call; 23, identifier:terms; 24, call; 25, identifier:count; 26, integer:0; 27, return_statement; 28, comparison_operator:count > 0; 29, block; 30, block; 31, identifier:sorted; 32, argument_list; 33, identifier:tuple; 34, generator_expression; 35, identifier:terms; 36, identifier:count; 37, integer:0; 38, return_statement; 39, raise_statement; 40, call; 41, keyword_argument; 42, subscript; 43, for_in_clause; 44, subscript; 45, call; 46, attribute; 47, argument_list; 48, identifier:key; 49, lambda; 50, identifier:i; 51, integer:0; 52, identifier:i; 53, identifier:terms; 54, identifier:terms; 55, slice; 56, identifier:ValueError; 57, argument_list; 58, attribute; 59, identifier:items; 60, lambda_parameters; 61, unary_operator; 62, identifier:count; 63, string:"Only non-negative values are allowed for count of terms."; 64, identifier:self; 65, identifier:_terms; 66, identifier:i; 67, subscript; 68, identifier:i; 69, integer:1
code: def most_frequent_terms(self, count=0):
          """
          Returns ``count`` of terms sorted by their frequency
          in descending order.
  
          :parameter int count:
              Max. number of returned terms. Value 0 means no limit (default).
          """
          # sort terms by number of occurrences in descending order
          terms = sorted(self._terms.items(), key=lambda i: -i[1])
  
          terms = tuple(i[0] for i in terms)
          if count == 0:
              return terms
          elif count > 0:
              return terms[:count]
          else:
              raise ValueError(
                  "Only non-negative values are allowed for count of terms.")