code: def _pop_index(self, index, has_default):
  		
  		try:
  			if index is NOT_SET:
  				index = len(self._list) - 1
  				key, value = self._list.pop()
  			else:
  				key, value = self._list.pop(index)
  				if index < 0:
  					index += len(self._list) + 1
  		except IndexError:
  			if has_default:
  				return None, None, None
  			else:
  				raise
  		index2, value2 = self._dict.pop(key)
  		assert index == index2
  		assert value is value2
  
  		return key, index, value
docs: Remove an element by index, or last element.