<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _write_imgdata(img, data, tr, x=0, y=0):
 """Write image data. Parameters img : `PIL.Image.Image` Image. data : `iterable` of `int` Image data. tr : `markovchain.image.traversal.Traversal` Image traversal. x : `int` X offset. y : `int` Y offset. """

        for pixel, (x1, y1) in zip(data, tr):
            img.putpixel((x + x1, y + y1), pixel)
        return img