def _get_response(self, timeout=<NUM_LIT:1.0>, eor=('<STR_LIT:\n>', '<STR_LIT>')):
<EOL>if (timeout is None or timeout < <NUM_LIT:0>) and eor == '<STR_LIT:\n>':<EOL><INDENT>return self._sio.readline()<EOL><DEDENT>else:<EOL><INDENT>if sys.hexversion >= <NUM_LIT>:<EOL><INDENT>maxtimeout = threading.TIMEOUT_MAX<EOL><DEDENT>else:<EOL><INDENT>maxtimeout = <NUM_LIT:7>*<NUM_LIT>*<NUM_LIT><EOL><DEDENT>timeout = min(timeout, maxtimeout)<EOL>tm = threading.Timer(timeout, lambda : None)<EOL>tm.start()<EOL>if isinstance(eor, str):<EOL><INDENT>eor = tuple([eor])<EOL><DEDENT>if sys.hexversion >= <NUM_LIT>:<EOL><INDENT>eor = [s.encode(encoding='<STR_LIT>') for s in eor]<EOL><DEDENT>buf = b'<STR_LIT>'<EOL>while not any([(x in buf) for x in eor]) and tm.is_alive():<EOL><INDENT>time.sleep(<NUM_LIT>)<EOL>buf += self._ser.read(self._ser.inWaiting())<EOL><DEDENT>tm.cancel()<EOL>matches = [(buf.find(x), x) for x in eor]<EOL>matches.sort(key=lambda x: x[<NUM_LIT:0>])<EOL>index = bytes([x[<NUM_LIT:0>] != -<NUM_LIT:1> for x in matches]).find(b'<STR_LIT>')<EOL>if index != -<NUM_LIT:1>:<EOL><INDENT>buf = buf[:(matches[index][<NUM_LIT:0>] + len(matches[index][<NUM_LIT:1>]))]<EOL><DEDENT>if sys.hexversion >= <NUM_LIT>:<EOL><INDENT>return buf.decode(errors='<STR_LIT:replace>')<EOL><DEDENT>else:<EOL><INDENT>return buf<EOL><DEDENT><DEDENT>
Reads a response from the drive.

        Reads the response returned by the drive with an optional
        timeout. All carriage returns and linefeeds are kept.

        Parameters
        ----------
        timeout : number, optional
            Optional timeout in seconds to use when reading the
            response. A negative value or ``None`` indicates that the
            an infinite timeout should be used.
        eor : str or iterable of str, optional
            ``str`` or iterable of ``str`` that denote the allowed
            End Of Response. For most commands, it should be
            ``('\\n', '\\n- ')``, but for running a program, it should
            be ``'*END\\n'``. The default is ``('\\n', '\\n- ')``.

        Returns
        -------
        response : str
            The response obtained from the drive. Carriage returns and
            linefeeds are preserved.