nodes: 0, module; 1, function_definition; 2, function_name:get_countries; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""
          Returns a list of dicts, one per country that has at least one Venue
          in it.
  
          Each dict has 'code' and 'name' elements.
          The list is sorted by the country 'name's.
          """; 12, assignment; 13, assignment; 14, identifier:c; 15, identifier:qs; 16, block; 17, call; 18, identifier:qs; 19, call; 20, identifier:countries; 21, list; 22, expression_statement; 23, identifier:sorted; 24, argument_list; 25, attribute; 26, argument_list; 27, call; 28, identifier:countries; 29, keyword_argument; 30, call; 31, line_continuation:\; 32, identifier:order_by; 33, string; 34, attribute; 35, argument_list; 36, identifier:key; 37, lambda; 38, attribute; 39, argument_list; 40, string_content:country; 41, identifier:countries; 42, identifier:append; 43, dictionary; 44, lambda_parameters; 45, subscript; 46, call; 47, line_continuation:\; 48, identifier:distinct; 49, pair; 50, pair; 51, identifier:k; 52, identifier:k; 53, string; 54, attribute; 55, argument_list; 56, string; 57, subscript; 58, string; 59, call; 60, string_content:name; 61, call; 62, line_continuation:\; 63, identifier:exclude; 64, keyword_argument; 65, string_content:code; 66, identifier:c; 67, string; 68, string_content:name; 69, attribute; 70, argument_list; 71, attribute; 72, argument_list; 73, identifier:country; 74, string; 75, string_content:country; 76, identifier:Venue; 77, identifier:get_country_name; 78, subscript; 79, attribute; 80, identifier:values; 81, string; 82, identifier:c; 83, string; 84, identifier:Venue; 85, identifier:objects; 86, string_content:country; 87, string_content:country
code: def get_countries(self):
          """
          Returns a list of dicts, one per country that has at least one Venue
          in it.
  
          Each dict has 'code' and 'name' elements.
          The list is sorted by the country 'name's.
          """
          qs = Venue.objects.values('country') \
                                      .exclude(country='') \
                                      .distinct() \
                                      .order_by('country')
  
          countries = []
  
          for c in qs:
              countries.append({
                  'code': c['country'],
                  'name': Venue.get_country_name(c['country'])
              })
  
          return sorted(countries, key=lambda k: k['name'])