'Reads up to n bytes, with at most one read() system call.'

def read1(self, n):

    if (n < 0):
        raise ValueError(u'number    of    bytes    to    read    must    be    positive')
    if (n == 0):
        return u''
    with self._read_lock:
        self._peek_unlocked(1)
        return self._read_unlocked(min(n, (len(self._read_buf) - self._read_pos)))
