def read_bytes(self, n):
    if (n == 1):
        result = self._socket_as_file().read(1)
        if (not result):
            raise errors.ConnectionError('Connection closed by Vertica')
        return result
    else:
        buf = b''
        to_read = n
        while (to_read > 0):
            data = self._socket_as_file().read(to_read)
            received = len(data)
            if (received == 0):
                raise errors.ConnectionError('Connection closed by Vertica')
            buf += data
            to_read -= received
        return buf
def read_bytes(self, n):
    if (n == 1):
        result = self._socket_as_file().read(1)
        if (not result):
            raise errors.ConnectionError('Connection closed by Vertica')
        return result
    else:
        buf = b
        to_read = n
        while (to_read > 0):
            data = self._socket_as_file().read(to_read)
            received = len(data)
            if (received == 0):
                raise errors.ConnectionError('Connection closed by Vertica')
            buf += data
            to_read -= received
        return buf