def copyfileobj(src, dst, length=None, exception=OSError, bufsize=None):
if bufsize is None:<EOL><INDENT>bufsize = pipebuf.PIPE_BUF_BYTES<EOL><DEDENT>if length == <NUM_LIT:0>:<EOL><INDENT>return<EOL><DEDENT>if length is None:<EOL><INDENT>shutil.copyfileobj(src, dst, bufsize)<EOL>return<EOL><DEDENT>blocks, remainder = divmod(length, bufsize)<EOL>for b in range(blocks):<EOL><INDENT>buf = src.read(bufsize)<EOL>if len(buf) < bufsize:<EOL><INDENT>raise exception("<STR_LIT>")<EOL><DEDENT>dst.write(buf)<EOL><DEDENT>if remainder != <NUM_LIT:0>:<EOL><INDENT>buf = src.read(remainder)<EOL>if len(buf) < remainder:<EOL><INDENT>raise exception("<STR_LIT>")<EOL><DEDENT>dst.write(buf)<EOL><DEDENT>return<EOL>
Copy length bytes from fileobj src to fileobj dst.
       If length is None, copy the entire content.