class_docstr: Persistent double ended queue (deque). Allows quick appends and pops in both ends. Implemented
  using two persistent lists.
  
  A maximum length can be specified to create a bounded queue.
  
  Fully supports the Sequence and Hashable protocols including indexing and slicing but
  if you need fast random access go for the PVector instead.
  
  Do not instantiate directly, instead use the factory functions :py:func:`dq` or :py:func:`pdeque` to
  create an instance.
  
  Some examples:
  
  >>> x = pdeque([1, 2, 3])
  >>> x.left
  1
  >>> x.right
  3
  >>> x[0] == x.left
  True
  >>> x[-1] == x.right
  True
  >>> x.pop()
  pdeque([1, 2])
  >>> x.pop() == x[:-1]
  True
  >>> x.popleft()
  pdeque([2, 3])
  >>> x.append(4)
  pdeque([1, 2, 3, 4])
  >>> x.appendleft(4)
  pdeque([4, 1, 2, 3])
  
  >>> y = pdeque([1, 2, 3], maxlen=3)
  >>> y.append(4)
  pdeque([2, 3, 4], maxlen=3)
  >>> y.appendleft(4)
  pdeque([4, 1, 2], maxlen=3)
code: def __getitem__(self, index):
      if isinstance(index, slice):
          if index.step is not None and index.step != 1:
              # Too difficult, no structural sharing possible
              return pdeque(tuple(self)[index], maxlen=self._maxlen)
  
          result = self
          if index.start is not None:
              result = result.popleft(index.start % self._length)
          if index.stop is not None:
              result = result.pop(
                  self._length - (index.stop % self._length)
              )
  
          return result
  
      if not isinstance(index, Integral):
          raise TypeError(
              "'%s' object cannot be interpreted as an index"
              % type(index).__name__
          )
  
      if index >= 0:
          return self.popleft(index).left
  
      shifted = len(self) + index
      if shifted < 0:
          raise IndexError(
              "pdeque index {0} out of range {1}".format(
                  index, len(self)
              ),
          )
      return self.popleft(shifted).left
  
imports: from collections.abc import Sequence, Hashable
  from itertools import islice, chain
  from numbers import Integral
  from typing import TypeVar, Generic
  from pyrsistent._plist import plist
label_desc: Use image node_id 28 for calling the PDeque obj's underlying member method code with example usage: obj.__getitem__(index) and returns: self, result, self, pdeque