def pop(self, blocking: bool = True) -> Optional[T]:
        """Get and remove an item from the set.

        Blocks until an item is available, unless blocking is set to False.

        Args:
            blocking: Whether to block until an item is ready. If not blocking
                and empty, will return None.
        """

        if self.read_lock.acquire(blocking=blocking):
            if not blocking and not self.event_nonempty.is_set():
                self.read_lock.release()
                return None

            self.event_nonempty.wait()

            if self.event_shutdown.is_set():
                self.read_lock.release()
                raise StopIteration("Set is shutdown.")

            item = next(iter(self.content))
            self.content.remove(item)

            if len(self.content) == 0:
                self.event_nonempty.clear()

            self.read_lock.release()

        else:
            # Acquire was used with blocking=False and it would have
            # blocked. Want the non-blocking behaviour to return None in such cases.
            return None

        return item
Get and remove an item from the set.

        Blocks until an item is available, unless blocking is set to False.

        Args:
            blocking: Whether to block until an item is ready. If not blocking
                and empty, will return None.
        
src/core/trulens/core/utils/containers.py