def decode_imdata(imdata):
    """Given a sequence of pixels, returns an iterator of characters
    encoded in the image"""
imdata = iter(imdata)
while True:
    pixels = list(imdata.next()[:3] + imdata.next()[:3] + imdata.next()[:3])
Стеганография в Python — Stepic