nodes: 0, module; 1, function_definition; 2, function_name:index_natsorted; 3, parameters; 4, block; 5, identifier:seq; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, import_from_statement; 12, expression_statement; 13, comment:# Pair the index and sequence together, then sort by; 14, expression_statement; 15, expression_statement; 16, return_statement; 17, identifier:key; 18, lambda; 19, identifier:number_type; 20, identifier:float; 21, identifier:signed; 22, True; 23, identifier:exp; 24, True; 25, comment:"""\
      Sorts a sequence naturally, but returns a list of sorted the
      indeces and not the sorted list.
  
          >>> a = ['num3', 'num5', 'num2']
          >>> b = ['foo', 'bar', 'baz']
          >>> index = index_natsorted(a)
          >>> index
          [2, 0, 1]
          >>> # Sort both lists by the sort order of a
          >>> [a[i] for i in index]
          ['num2', 'num3', 'num5']
          >>> [b[i] for i in index]
          ['baz', 'foo', 'bar']
          >>> c = [('a', 'num3'), ('b', 'num5'), ('c', 'num2')]
          >>> from operator import itemgetter
          >>> index_natsorted(c, key=itemgetter(1))
          [2, 0, 1]
  
      """; 26, dotted_name; 27, dotted_name; 28, assignment; 29, assignment; 30, call; 31, list_comprehension; 32, lambda_parameters; 33, identifier:x; 34, identifier:operator; 35, identifier:itemgetter; 36, identifier:item1; 37, call; 38, identifier:index_seq_pair; 39, list_comprehension; 40, attribute; 41, argument_list; 42, subscript; 43, for_in_clause; 44, identifier:x; 45, identifier:itemgetter; 46, argument_list; 47, list; 48, for_in_clause; 49, identifier:index_seq_pair; 50, identifier:sort; 51, keyword_argument; 52, identifier:x; 53, integer:0; 54, identifier:x; 55, identifier:index_seq_pair; 56, integer:1; 57, identifier:x; 58, call; 59, pattern_list; 60, call; 61, identifier:key; 62, lambda; 63, identifier:key; 64, argument_list; 65, identifier:x; 66, identifier:y; 67, identifier:zip; 68, argument_list; 69, lambda_parameters; 70, call; 71, identifier:y; 72, call; 73, identifier:seq; 74, identifier:x; 75, identifier:natsort_key; 76, argument_list; 77, identifier:range; 78, argument_list; 79, call; 80, keyword_argument; 81, keyword_argument; 82, keyword_argument; 83, call; 84, identifier:item1; 85, argument_list; 86, identifier:number_type; 87, identifier:number_type; 88, identifier:signed; 89, identifier:signed; 90, identifier:exp; 91, identifier:exp; 92, identifier:len; 93, argument_list; 94, identifier:x; 95, identifier:seq
code: def index_natsorted(seq, key=lambda x: x, number_type=float, signed=True, exp=True):
      """\
      Sorts a sequence naturally, but returns a list of sorted the
      indeces and not the sorted list.
  
          >>> a = ['num3', 'num5', 'num2']
          >>> b = ['foo', 'bar', 'baz']
          >>> index = index_natsorted(a)
          >>> index
          [2, 0, 1]
          >>> # Sort both lists by the sort order of a
          >>> [a[i] for i in index]
          ['num2', 'num3', 'num5']
          >>> [b[i] for i in index]
          ['baz', 'foo', 'bar']
          >>> c = [('a', 'num3'), ('b', 'num5'), ('c', 'num2')]
          >>> from operator import itemgetter
          >>> index_natsorted(c, key=itemgetter(1))
          [2, 0, 1]
  
      """
      from operator import itemgetter
      item1 = itemgetter(1)
      # Pair the index and sequence together, then sort by
      index_seq_pair = [[x, key(y)] for x, y in zip(range(len(seq)), seq)]
      index_seq_pair.sort(key=lambda x: natsort_key(item1(x),
                                                    number_type=number_type,
                                                    signed=signed, exp=exp))
      return [x[0] for x in index_seq_pair]