code: def index_natsorted(seq, key=None, reverse=False, alg=ns.DEFAULT):
      if key is None:
          newkey = itemgetter(1)
      else:
          def newkey(x):
              return key(itemgetter(1)(x))
      index_seq_pair = [[x, y] for x, y in enumerate(seq)]
      index_seq_pair.sort(reverse=reverse, key=natsort_keygen(newkey, alg))
      return [x for x, _ in index_seq_pair]