nodes: 0, module; 1, function_definition; 2, function_name:to_items; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, return_statement; 9, identifier:func; 10, identifier:str; 11, comment:"""
          Contruct a list of dictionary items.
  
          The items are normalized using:
            -  A sort function by key (for consistent results)
            -  A transformation function for values
  
          The transformation function will default to `str`, which is a good choice when encoding values
          as part of a response; this requires that complex types (UUID, Enum, etc.) have a valid string
          encoding.
  
          The transformation function should be set to `identity` in cases where raw values are desired;
          this is normally necessary when passing page data to controller functions as kwargs.
  
          """; 12, list_comprehension; 13, tuple; 14, for_in_clause; 15, identifier:key; 16, call; 17, identifier:key; 18, call; 19, identifier:func; 20, argument_list; 21, identifier:sorted; 22, argument_list; 23, subscript; 24, call; 25, attribute; 26, identifier:key; 27, attribute; 28, argument_list; 29, identifier:self; 30, identifier:kwargs; 31, attribute; 32, identifier:keys; 33, identifier:self; 34, identifier:kwargs
code: def to_items(self, func=str):
          """
          Contruct a list of dictionary items.
  
          The items are normalized using:
            -  A sort function by key (for consistent results)
            -  A transformation function for values
  
          The transformation function will default to `str`, which is a good choice when encoding values
          as part of a response; this requires that complex types (UUID, Enum, etc.) have a valid string
          encoding.
  
          The transformation function should be set to `identity` in cases where raw values are desired;
          this is normally necessary when passing page data to controller functions as kwargs.
  
          """
          return [
              (key, func(self.kwargs[key]))
              for key in sorted(self.kwargs.keys())
          ]