def patchstream(instream, outstream, delta):
    """
    Patches instream using the supplied delta and write the resultantant
    data to outstream.
    """
    blocksize = delta[0]

    for element in delta[1:]:
        if isinstance(element, int) and blocksize:
            instream.seek(element * blocksize)
            element = instream.read(blocksize)
        outstream.write(element)

    Patches instream using the supplied delta and write the resultantant
    data to outstream.
    
recipes/Python/577518_Rsync_Algorithm/recipe-577518.py