def read_until(self, marker):
if not isinstance(marker, byte_cls) and not isinstance(marker, Pattern):<EOL><INDENT>raise TypeError(pretty_message(<EOL>'''<STR_LIT>''',<EOL>type_name(marker)<EOL>))<EOL><DEDENT>output = b'<STR_LIT>'<EOL>is_regex = isinstance(marker, Pattern)<EOL>while True:<EOL><INDENT>if len(self._decrypted_bytes) > <NUM_LIT:0>:<EOL><INDENT>chunk = self._decrypted_bytes<EOL>self._decrypted_bytes = b'<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>if self._ssl is None:<EOL><INDENT>self._raise_closed()<EOL><DEDENT>to_read = libssl.SSL_pending(self._ssl) or <NUM_LIT><EOL>chunk = self.read(to_read)<EOL><DEDENT>offset = len(output)<EOL>output += chunk<EOL>if is_regex:<EOL><INDENT>match = marker.search(output)<EOL>if match is not None:<EOL><INDENT>end = match.end()<EOL>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>start = max(<NUM_LIT:0>, offset - len(marker) - <NUM_LIT:1>)<EOL>match = output.find(marker, start)<EOL>if match != -<NUM_LIT:1>:<EOL><INDENT>end = match + len(marker)<EOL>break<EOL><DEDENT><DEDENT><DEDENT>self._decrypted_bytes = output[end:] + self._decrypted_bytes<EOL>return output[<NUM_LIT:0>:end]<EOL>
Reads data from the socket until a marker is found. Data read includes
the marker.

:param marker:
    A byte string or regex object from re.compile(). Used to determine
    when to stop reading. Regex objects are more inefficient since
    they must scan the entire byte string of read data each time data
    is read off the socket.

:return:
    A byte string of the data read, including the marker