code: def permutate_list(lst, indices, inv):
      ret = [None] * len(lst)
      if inv:
          for i, ind in enumerate(indices):
              ret[ind] = lst[i]
      else:
          for i, ind in enumerate(indices):
              ret[i] = lst[ind]
      return ret
  
imports: import numpy
  import six
  import chainer
  from chainer.functions.array import permutate
  from chainer.functions.array import transpose_sequence
  from chainer.functions.rnn import n_step_rnn
  from chainer import initializers
  from chainer import link
  from chainer.utils import argument
  from chainer import variable
label_desc: Use image node_id 2 for calling a global function with example usage: permutate_list(lst, indices, inv) and returns: ret