def read(self, size=None):
if self.closed:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>buf = b"<STR_LIT>"<EOL>if self.buffer:<EOL><INDENT>if size is None:<EOL><INDENT>buf = self.buffer<EOL>self.buffer = b"<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>buf = self.buffer[:size]<EOL>self.buffer = self.buffer[size:]<EOL><DEDENT><DEDENT>if size is None:<EOL><INDENT>buf += self.fileobj.read()<EOL><DEDENT>else:<EOL><INDENT>buf += self.fileobj.read(size - len(buf))<EOL><DEDENT>self.position += len(buf)<EOL>return buf<EOL>
Read at most size bytes from the file. If size is not
           present or None, read all data until EOF is reached.