def decode_utf8(input_iterator):
    """
    Generator that decodes a utf-8 encoded
    input line by line
    """
    for l in input_iterator:
        yield l if isinstance(l, str) else l.decode('utf-8')
