'Attempts to find a position in the read buffer that satisfies
the currently-pending read.
Returns a position in the buffer if the current read can be satisfied,
or None if it cannot.'

def _find_read_pos(self):

    if ((self._read_bytes is not None) and ((self._read_buffer_size >= self._read_bytes) or (self._read_partial and (self._read_buffer_size > 0)))):
        num_bytes = min(self._read_bytes, self._read_buffer_size)
        return num_bytes
    elif (self._read_delimiter is not None):
        if self._read_buffer:
            while True:
                loc = self._read_buffer[0].find(self._read_delimiter)
                if (loc != (-1)):
                    delimiter_len = len(self._read_delimiter)
                    self._check_max_bytes(self._read_delimiter, (loc + delimiter_len))
                    return (loc + delimiter_len)
                if (len(self._read_buffer) == 1):
                    break
                _double_prefix(self._read_buffer)
            self._check_max_bytes(self._read_delimiter, len(self._read_buffer[0]))
    elif (self._read_regex is not None):
        if self._read_buffer:
            while True:
                m = self._read_regex.search(self._read_buffer[0])
                if (m is not None):
                    self._check_max_bytes(self._read_regex, m.end())
                    return m.end()
                if (len(self._read_buffer) == 1):
                    break
                _double_prefix(self._read_buffer)
            self._check_max_bytes(self._read_regex, len(self._read_buffer[0]))
    return None
