with open(dest, 'wb') as f2:
    while length:
        chunk = min(bufsize, length)
data = f1.read(chunk)
f2.write(data)
length -= chunk
if __name__ == '__main__':
    GIG = 2 ** 30
copypart('test.bin', 'test2.bin', 1 * GIG, 8 * GIG)
Python: slicing a very large binary file