nodes: 0, module; 1, function_definition; 2, function_name:sort_sections; 3, parameters; 4, block; 5, identifier:self; 6, identifier:order; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, assert_statement; 12, expression_statement; 13, comment:"""
          Sort sections according to the section names in the order list. All remaining sections
           are added to the end in their original order
  
          :param order: Iterable of section names
          :return:
          """; 14, assignment; 15, assignment; 16, call; 17, comparison_operator:len(self.sections) == len(sections); 18, assignment; 19, identifier:order_lc; 20, list_comprehension; 21, identifier:sections; 22, call; 23, attribute; 24, generator_expression; 25, call; 26, call; 27, attribute; 28, identifier:sections; 29, call; 30, for_in_clause; 31, identifier:OrderedDict; 32, generator_expression; 33, identifier:sections; 34, identifier:update; 35, tuple; 36, for_in_clause; 37, if_clause; 38, identifier:len; 39, argument_list; 40, identifier:len; 41, argument_list; 42, identifier:self; 43, identifier:sections; 44, attribute; 45, argument_list; 46, identifier:e; 47, identifier:order; 48, tuple; 49, for_in_clause; 50, if_clause; 51, identifier:k; 52, subscript; 53, identifier:k; 54, call; 55, comparison_operator:k not in order_lc; 56, attribute; 57, identifier:sections; 58, identifier:e; 59, identifier:lower; 60, identifier:k; 61, subscript; 62, identifier:k; 63, identifier:order_lc; 64, comparison_operator:k in self.sections; 65, attribute; 66, identifier:k; 67, attribute; 68, argument_list; 69, identifier:k; 70, identifier:order_lc; 71, identifier:self; 72, identifier:sections; 73, attribute; 74, identifier:k; 75, identifier:k; 76, attribute; 77, identifier:self; 78, identifier:sections; 79, attribute; 80, identifier:keys; 81, identifier:self; 82, identifier:sections; 83, identifier:self; 84, identifier:sections; 85, identifier:self; 86, identifier:sections
code: def sort_sections(self, order):
          """
          Sort sections according to the section names in the order list. All remaining sections
           are added to the end in their original order
  
          :param order: Iterable of section names
          :return:
          """
  
          order_lc = [e.lower() for e in order]
  
          sections = OrderedDict( (k,self.sections[k]) for k in order_lc if k in self.sections)
  
          sections.update( (k,self.sections[k]) for k in self.sections.keys() if k not in order_lc)
  
          assert len(self.sections) == len(sections)
  
          self.sections = sections