nodes: 0, module; 1, function_definition; 2, function_name:get_freq_tuples; 3, parameters; 4, block; 5, identifier:my_list; 6, identifier:print_total_threshold; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:""" Turn a list of errors into frequency-sorted tuples thresholded by a certain total number """; 12, assignment; 13, identifier:token; 14, identifier:my_list; 15, block; 16, subscript; 17, identifier:d; 18, dictionary; 19, expression_statement; 20, expression_statement; 21, call; 22, slice; 23, call; 24, augmented_assignment; 25, identifier:sorted; 26, argument_list; 27, identifier:print_total_threshold; 28, attribute; 29, argument_list; 30, subscript; 31, integer:1; 32, call; 33, keyword_argument; 34, keyword_argument; 35, identifier:d; 36, identifier:setdefault; 37, identifier:token; 38, integer:0; 39, identifier:d; 40, identifier:token; 41, attribute; 42, argument_list; 43, identifier:key; 44, call; 45, identifier:reverse; 46, True; 47, identifier:d; 48, identifier:items; 49, attribute; 50, argument_list; 51, identifier:operator; 52, identifier:itemgetter; 53, integer:1
code: def get_freq_tuples(my_list, print_total_threshold):
      """ Turn a list of errors into frequency-sorted tuples thresholded by a certain total number """
      d = {}
      for token in my_list:
          d.setdefault(token, 0)
          d[token] += 1
      return sorted(d.items(), key=operator.itemgetter(1), reverse=True)[:print_total_threshold]