def copy_image(src=None, dst=None):
    try:
        src_fd = os.open(src, os.O_RDONLY)
        dst_fd = os.open(dst, os.O_WRONLY | os.O_CREAT, 0644)
        blks = 0
        blksize = 64 * 1024
        log.debug("copying {0} to {1}".format(src, dst))
        while True:
            buf = os.read(src_fd, blksize)
            if len(buf) <= 0:
                log.debug("{0} {1} blocks written.".format(blks, blksize))
                os.close(src_fd)
                os.close(dst_fd)
                break
            out = os.write(dst_fd, buf)
            if out < blksize:
                log.debug('wrote {0} bytes.'.format(out))
            blks += 1
    except OSError as e:
        log.debug("{0}: errno[{1}]: {2}.".format(e.filename, e.errno, e.strerror))
        return False
    return True
A stream adjusted to depend on itself causes a Protocol Error.
dataset/ETHPy150Open Netflix/aminator/aminator/util/linux.py/copy_image--crossover with--dataset/ETHPy150Open python-hyper/hyper-h2/test/test_priority.py/TestPriority.test_streams_may_not_depend_on_themselves