nodes: 0, module; 1, function_definition; 2, function_name:insert; 3, parameters; 4, block; 5, identifier:self; 6, identifier:index; 7, identifier:key; 8, identifier:value; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, comment:"""Inserts the key, value pair before the item with the given index."""; 14, comparison_operator:key in self.keyOrder; 15, block; 16, call; 17, call; 18, identifier:key; 19, attribute; 20, expression_statement; 21, delete_statement; 22, if_statement; 23, attribute; 24, argument_list; 25, attribute; 26, argument_list; 27, identifier:self; 28, identifier:keyOrder; 29, assignment; 30, subscript; 31, comparison_operator:n < index; 32, block; 33, attribute; 34, identifier:insert; 35, identifier:index; 36, identifier:key; 37, call; 38, identifier:__setitem__; 39, identifier:key; 40, identifier:value; 41, identifier:n; 42, call; 43, attribute; 44, identifier:n; 45, identifier:n; 46, identifier:index; 47, expression_statement; 48, identifier:self; 49, identifier:keyOrder; 50, identifier:super; 51, argument_list; 52, attribute; 53, argument_list; 54, identifier:self; 55, identifier:keyOrder; 56, augmented_assignment; 57, identifier:SortedDict; 58, identifier:self; 59, attribute; 60, identifier:index; 61, identifier:key; 62, identifier:index; 63, integer:1; 64, identifier:self; 65, identifier:keyOrder
code: def insert(self, index, key, value):
          """Inserts the key, value pair before the item with the given index."""
          if key in self.keyOrder:
              n = self.keyOrder.index(key)
              del self.keyOrder[n]
              if n < index:
                  index -= 1
          self.keyOrder.insert(index, key)
          super(SortedDict, self).__setitem__(key, value)