nodes: 0, module; 1, function_definition; 2, function_name:sort_menus; 3, parameters; 4, block; 5, identifier:c; 6, expression_statement; 7, for_statement; 8, comment:"""
          sort_menus goes through the items and sorts them based on
          their weight
          """; 9, identifier:name; 10, attribute; 11, block; 12, identifier:c; 13, identifier:items; 14, if_statement; 15, not_operator; 16, block; 17, subscript; 18, expression_statement; 19, expression_statement; 20, attribute; 21, identifier:name; 22, call; 23, assignment; 24, identifier:c; 25, identifier:sorted; 26, attribute; 27, argument_list; 28, subscript; 29, True; 30, subscript; 31, identifier:sort; 32, keyword_argument; 33, attribute; 34, identifier:name; 35, attribute; 36, identifier:name; 37, identifier:key; 38, lambda; 39, identifier:c; 40, identifier:sorted; 41, identifier:c; 42, identifier:items; 43, lambda_parameters; 44, attribute; 45, identifier:x; 46, identifier:x; 47, identifier:weight
code: def sort_menus(c):
          """
          sort_menus goes through the items and sorts them based on
          their weight
          """
          for name in c.items:
              if not c.sorted[name]:
                  c.items[name].sort(key=lambda x: x.weight)
                  c.sorted[name] = True