def _peek_buf(self, datalen):
        """Ensure local inbound buffer has enough data, and return that data without
        consuming the local buffer

        It's expected that the caller handles e.g. blocking exceptions"""
        while True:
            bytes_remaining = datalen - len(self._buffer_in)
            if bytes_remaining <= 0:
                break
            data = self._sock.recv(bytes_remaining)
            if not data:
                break
            self._buffer_in = self._buffer_in + data

        return self._buffer_in[:datalen]
Ensure local inbound buffer has enough data, and return that data without
        consuming the local buffer

        It's expected that the caller handles e.g. blocking exceptions
kafka/socks5_wrapper.py