def poll(self, timeout):
timeout = float(timeout)<EOL>end_time = time.time() + timeout<EOL>while True:<EOL><INDENT>incoming = self.stream.read(self._max_read)<EOL>if incoming:<EOL><INDENT>return incoming<EOL><DEDENT>if (end_time - time.time()) < <NUM_LIT:0>:<EOL><INDENT>raise ExpectTimeout()<EOL><DEDENT>time.sleep(self._poll_period)<EOL><DEDENT>
:param float timeout: Timeout in seconds.