'Read at most size bytes from the file.
Fewer bytes are read if the read hits EOF before obtaining size bytes.
If the size argument is negative or omitted, read all data until EOF is
reached. The bytes are returned as a string object. An empty string is
returned when EOF is encountered immediately.
Calling read() without a size specified is likely to be dangerous, as it
may read excessive amounts of data.
Args:
size: Optional. The maximum number of bytes to read. When omitted, read()
returns all remaining data in the file.
Returns:
The read data, as a string.'

def read(self, size=(-1)):

    data_list = []
    while True:
        (data, size) = self.__read_from_buffer(size)
        data_list.append(data)
        if ((size == 0) or self.__eof):
            return ''.join(data_list)
        self.__fill_buffer(size)
