nodes: 0, module; 1, function_definition; 2, function_name:list_gemeenten; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, function_definition; 9, if_statement; 10, for_statement; 11, return_statement; 12, identifier:sort; 13, integer:1; 14, string; 15, function_name:creator; 16, parameters; 17, block; 18, attribute; 19, block; 20, else_clause; 21, identifier:g; 22, identifier:gemeente; 23, block; 24, identifier:gemeente; 25, string_content:List all `gemeenten` in Vlaanderen.
  
          :param integer sort: What field to sort on.
          :rtype: A :class:`list` of :class:`Gemeente`.; 26, expression_statement; 27, expression_statement; 28, expression_statement; 29, expression_statement; 30, return_statement; 31, subscript; 32, identifier:is_configured; 33, expression_statement; 34, expression_statement; 35, block; 36, expression_statement; 37, assignment; 38, assignment; 39, assignment; 40, assignment; 41, list_comprehension; 42, attribute; 43, string; 44, assignment; 45, assignment; 46, expression_statement; 47, call; 48, identifier:url; 49, binary_operator:self.base_url + '/municipality'; 50, identifier:h; 51, attribute; 52, identifier:p; 53, dictionary; 54, identifier:res; 55, call; 56, call; 57, for_in_clause; 58, identifier:self; 59, identifier:caches; 60, string_content:permanent; 61, identifier:key; 62, binary_operator:'list_gemeenten_rest#%s' % sort; 63, identifier:gemeente; 64, call; 65, assignment; 66, attribute; 67, argument_list; 68, attribute; 69, string; 70, identifier:self; 71, identifier:base_headers; 72, pair; 73, attribute; 74, argument_list; 75, identifier:Gemeente; 76, argument_list; 77, identifier:r; 78, subscript; 79, string; 80, identifier:sort; 81, attribute; 82, argument_list; 83, identifier:gemeente; 84, call; 85, identifier:g; 86, identifier:set_gateway; 87, identifier:self; 88, identifier:self; 89, identifier:base_url; 90, string_content:/municipality; 91, string; 92, comparison_operator:sort == 1; 93, call; 94, identifier:json; 95, subscript; 96, subscript; 97, identifier:res; 98, string; 99, string_content:list_gemeenten_rest#%s; 100, subscript; 101, identifier:get_or_create; 102, identifier:key; 103, identifier:creator; 104, identifier:creator; 105, argument_list; 106, string_content:orderbyCode; 107, identifier:sort; 108, integer:1; 109, identifier:capakey_rest_gateway_request; 110, argument_list; 111, identifier:r; 112, string; 113, identifier:r; 114, string; 115, string_content:municipalities; 116, attribute; 117, string; 118, identifier:url; 119, identifier:h; 120, identifier:p; 121, string_content:municipalityCode; 122, string_content:municipalityName; 123, identifier:self; 124, identifier:caches; 125, string_content:permanent
code: def list_gemeenten(self, sort=1):
          '''
          List all `gemeenten` in Vlaanderen.
  
          :param integer sort: What field to sort on.
          :rtype: A :class:`list` of :class:`Gemeente`.
          '''
  
          def creator():
              url = self.base_url + '/municipality'
              h = self.base_headers
              p = {
                  'orderbyCode': sort == 1
              }
              res = capakey_rest_gateway_request(url, h, p).json()
              return [
                  Gemeente(r['municipalityCode'], r['municipalityName'])
                  for r in res['municipalities']
              ]
  
          if self.caches['permanent'].is_configured:
              key = 'list_gemeenten_rest#%s' % sort
              gemeente = self.caches['permanent'].get_or_create(key, creator)
          else:
              gemeente = creator()
          for g in gemeente:
              g.set_gateway(self)
          return gemeente