code: def pop(self):
          
          root = self.heap[1]
          del self.rank[root]
          x = self.heap.pop()    # remove last leaf
          if self:               # if heap is not empty
              self.heap[1] = x   # put last leaf to root
              self.rank[x] = 1
              self.down(1)       # maintain heap order
          return root
docs: Remove and return smallest element