def enqueue(self, priority: int, item: TItem) -> bool:
        """Adds an entry to the priority queue.

        If drop_duplicate_entries is set and there is already a (priority, item)
        entry in the queue, then the enqueue is ignored. Check the return value
        to determine if an enqueue was kept or dropped.

        Args:
            priority: The priority of the item. Lower priorities dequeue before
                higher priorities.
            item: The item associated with the given priority.

        Returns:
            True if the item was enqueued. False if drop_duplicate_entries is
            set and the item is already in the queue.
        """
        if self._drop_set is not None:
            if (priority, item) in self._drop_set:
                return False
            self._drop_set.add((priority, item))

        # First enqueue initializes self._offset.
        if not self._buckets:
            self._buckets.append([item])
            self._offset = priority
            self._len = 1
            return True

        # Where is the bucket this item is supposed to go into?
        i = priority - self._offset

        # Extend bucket list backwards if needed.
        if i < 0:
            self._buckets[:0] = [[] for _ in range(-i)]
            self._offset = priority
            i = 0

        # Extend bucket list forwards if needed.
        while i >= len(self._buckets):
            self._buckets.append([])

        # Finish by adding item to the intended bucket's list.
        self._buckets[i].append(item)
        self._len += 1
        return True
Adds an entry to the priority queue.

        If drop_duplicate_entries is set and there is already a (priority, item)
        entry in the queue, then the enqueue is ignored. Check the return value
        to determine if an enqueue was kept or dropped.

        Args:
            priority: The priority of the item. Lower priorities dequeue before
                higher priorities.
            item: The item associated with the given priority.

        Returns:
            True if the item was enqueued. False if drop_duplicate_entries is
            set and the item is already in the queue.