class_docstr: FIFO queue with fast indexing
  
  Operations getitem, setitem, append, popleft, and len
  are amortized O(1)-time, if this data structure is used ephemerally.
code: def __getitem__(self, i):
      if i >= 0:
          nf = len(self._queue_front)
          if i < nf:
              return self._queue_front[~i]
          else:
              i -= nf
              if i < len(self._queue_back):
                  return self._queue_back[i]
              else:
                  raise IndexError(
                      "RandomAccessQueue index out of range"
                  )
  
      else:
          nb = len(self._queue_back)
          if i >= -nb:
              return self._queue_back[i]
          else:
              i += nb
              if i >= -len(self._queue_front):
                  return self._queue_front[~i]
              else:
                  raise IndexError(
                      "RandomAccessQueue index out of range"
                  )
  
file_path: pfrl/pfrl/collections/random_access_queue.py
imports: import itertools
  from pfrl.utils.random import sample_n_k
label_desc: Use image node_id 6 for calling the RandomAccessQueue obj's underlying member method code with example usage: obj.__getitem__(i) and returns: self, self, self, self