If *block* is True, this method blocks until an element can be removed from
    the deque with the specified *method*. If *block* is False, the function
    will raise #Empty if no elements are available.

    # Arguments
    block (bool): #True to block and wait until an element becomes available,
      #False otherwise.
    timeout (number, None): The timeout in seconds to use when waiting for
      an element (only with `block=True`).
    method (str): The name of the method to use to remove an element from the
      queue. Must be either `'pop'` or `'popleft'`.

    # Raises
    ValueError: If *method* has an invalid value.
    Timeout: If the *timeout* is exceeded.

def get(self, block=True, timeout=None, method='pop'):
    """
    If *block* is True, this method blocks until an element can be removed from
    the deque with the specified *method*. If *block* is False, the function
    will raise #Empty if no elements are available.

    # Arguments
    block (bool): #True to block and wait until an element becomes available,
      #False otherwise.
    timeout (number, None): The timeout in seconds to use when waiting for
      an element (only with `block=True`).
    method (str): The name of the method to use to remove an element from the
      queue. Must be either `'pop'` or `'popleft'`.

    # Raises
    ValueError: If *method* has an invalid value.
    Timeout: If the *timeout* is exceeded.
    """

    if method not in ('pop', 'popleft'):
      raise ValueError('method must be "pop" or "popleft": {0!r}'.format(method))

    t_start = time.clock()
    while not self:
      if not block:
        raise self.Empty

      if timeout is None:
        wait(self)
      else:
        t_delta = time.clock() - t_start
        if t_delta > timeout:
          raise Timeout
        wait(self, timeout - t_delta)

    return getattr(self, method)()