def empty(self):
        """
        Clear out the buffer and return all data that was in it.

        :return:
            any data that was in the buffer prior to clearing it out, as a
            `str`
        """
        self._lock.acquire()
        try:
            out = self._buffer_tobytes()
            del self._buffer[:]
            if (self._event is not None) and not self._closed:
                self._event.clear()
            return out
        finally:
            self._lock.release()
def empty ( self ) : self . _lock . acquire ( ) try : out = self . _buffer_tobytes ( ) del self . _buffer [ : ] if ( self . _event is not None ) and not self . _closed : self . _event . clear ( ) return out finally : self . _lock . release ( )
Clear out the buffer and return all data that was in it.

        :return:
            any data that was in the buffer prior to clearing it out, as a
            `str`