nodes: 0, module; 1, function_definition; 2, function_name:sortedIndex; 3, parameters; 4, block; 5, identifier:self; 6, identifier:obj; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, while_statement; 14, return_statement; 15, identifier:iterator; 16, lambda; 17, comment:"""
          Use a comparator function to figure out the smallest index at which
          an object should be inserted so as to maintain order.
          Uses binary search.
          """; 18, assignment; 19, assignment; 20, assignment; 21, assignment; 22, comparison_operator:low < high; 23, block; 24, call; 25, lambda_parameters; 26, identifier:x; 27, identifier:array; 28, attribute; 29, identifier:value; 30, call; 31, identifier:low; 32, integer:0; 33, identifier:high; 34, call; 35, identifier:low; 36, identifier:high; 37, expression_statement; 38, if_statement; 39, attribute; 40, argument_list; 41, identifier:x; 42, identifier:self; 43, identifier:obj; 44, identifier:iterator; 45, argument_list; 46, identifier:len; 47, argument_list; 48, assignment; 49, comparison_operator:iterator(array[mid]) < value; 50, block; 51, else_clause; 52, identifier:self; 53, identifier:_wrap; 54, identifier:low; 55, identifier:obj; 56, identifier:array; 57, identifier:mid; 58, binary_operator:(low + high) >> 1; 59, call; 60, identifier:value; 61, expression_statement; 62, block; 63, parenthesized_expression; 64, integer:1; 65, identifier:iterator; 66, argument_list; 67, assignment; 68, expression_statement; 69, binary_operator:low + high; 70, subscript; 71, identifier:low; 72, binary_operator:mid + 1; 73, assignment; 74, identifier:low; 75, identifier:high; 76, identifier:array; 77, identifier:mid; 78, identifier:mid; 79, integer:1; 80, identifier:high; 81, identifier:mid
code: def sortedIndex(self, obj, iterator=lambda x: x):
          """
          Use a comparator function to figure out the smallest index at which
          an object should be inserted so as to maintain order.
          Uses binary search.
          """
          array = self.obj
          value = iterator(obj)
          low = 0
          high = len(array)
          while low < high:
              mid = (low + high) >> 1
              if iterator(array[mid]) < value:
                  low = mid + 1
              else:
                  high = mid
          return self._wrap(low)