code: def get_recurrent_state_at(
      link, recurrent_state, indices, unwrap_variable
  ):
      if recurrent_state is None:
          return None
      if isinstance(link, L.NStepLSTM):
          h, c = recurrent_state
          if unwrap_variable:
              h = h.array
              c = c.array
          # shape: (n_layers, batch_size, out_size)
          assert h.ndim == 3
          assert c.ndim == 3
          return (h[:, indices], c[:, indices])
      if isinstance(link, (L.NStepGRU, L.NStepRNNReLU, L.NStepRNNTanh)):
          h = recurrent_state
          if unwrap_variable:
              h = h.array
          # shape: (n_layers, batch_size, out_size)
          assert h.ndim == 3
          return h[:, indices]
      if isinstance(link, StatelessRecurrent):
          return link.get_recurrent_state_at(
              recurrent_state, indices, unwrap_variable
          )
      else:
          raise ValueError("{} is not a recurrent link".format(link))
  
imports: from cached_property import cached_property
  import chainer
  import chainer.functions
  import chainer.links
  import numpy
label_desc: Use image node_id 10 for calling a global function with example usage: get_recurrent_state_at(link, recurrent_state, indices, unwrap_variable) and returns: None, h,  c, h, link