code: def popfirst(self):
          
  
          with self.lock:
  
              try:
                  tup = self.data.popleft()
              except IndexError as ex:
                  ex.args = ('DEPQ is already empty',)
                  raise
  
              self_items = self.items
  
              try:
                  self_items[tup[0]] -= 1
                  if self_items[tup[0]] == 0:
                      del self_items[tup[0]]
              except TypeError:
                  r = repr(tup[0])
                  self_items[r] -= 1
                  if self_items[r] == 0:
                      del self_items[r]
  
              return tup
docs: Removes item with highest priority from DEPQ. Returns
          tuple(item, priority). Performance: O(1)