nodes: 0, module; 1, function_definition; 2, function_name:sort_items; 3, parameters; 4, block; 5, identifier:items; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""sorts the items into a dictionary of categories, with a list of items"""; 11, assignment; 12, identifier:item; 13, identifier:items; 14, block; 15, identifier:sorted_items; 16, identifier:sorted_items; 17, dictionary; 18, expression_statement; 19, if_statement; 20, expression_statement; 21, assignment; 22, comparison_operator:sorted_items.get(category) is None; 23, block; 24, call; 25, identifier:category; 26, call; 27, call; 28, None; 29, expression_statement; 30, attribute; 31, argument_list; 32, identifier:lookup; 33, argument_list; 34, attribute; 35, argument_list; 36, assignment; 37, subscript; 38, identifier:append; 39, identifier:item; 40, identifier:item; 41, string; 42, string; 43, identifier:sorted_items; 44, identifier:get; 45, identifier:category; 46, subscript; 47, list; 48, identifier:sorted_items; 49, identifier:category; 50, string_content:itemCategory; 51, string_content:categoryCode; 52, identifier:sorted_items; 53, identifier:category
code: def sort_items(items):
      """sorts the items into a dictionary of categories, with a list of items"""
  
      sorted_items = {}
      for item in items:
          category = lookup(item, 'itemCategory', 'categoryCode')
          if sorted_items.get(category) is None:
              sorted_items[category] = []
          sorted_items[category].append(item)
  
      return sorted_items