def rldecode(data):
decoded = []<EOL>i = <NUM_LIT:0><EOL>while i < len(data):<EOL><INDENT>length = ord(data[i])<EOL>if length == <NUM_LIT>:<EOL><INDENT>break<EOL><DEDENT>if length >= <NUM_LIT:0> and length < <NUM_LIT>:<EOL><INDENT>run = data[i+<NUM_LIT:1>:(i+<NUM_LIT:1>)+(length+<NUM_LIT:1>)]<EOL>decoded.append(run)<EOL>i = (i+<NUM_LIT:1>) + (length+<NUM_LIT:1>)<EOL><DEDENT>if length > <NUM_LIT>:<EOL><INDENT>run = data[i+<NUM_LIT:1>]*(<NUM_LIT>-length)<EOL>decoded.append(run)<EOL>i = (i+<NUM_LIT:1>) + <NUM_LIT:1><EOL><DEDENT><DEDENT>return b'<STR_LIT>'.join(decoded)<EOL>
RunLength decoder (Adobe version) implementation based on PDF Reference
version 1.4 section 3.3.4:
    The RunLengthDecode filter decodes data that has been encoded in a
    simple byte-oriented format based on run length. The encoded data
    is a sequence of runs, where each run consists of a length byte
    followed by 1 to 128 bytes of data. If the length byte is in the
    range 0 to 127, the following length + 1 (1 to 128) bytes are
    copied literally during decompression. If length is in the range
    129 to 255, the following single byte is to be copied 257 - length
    (2 to 128) times during decompression. A length value of 128
    denotes EOD.
>>> s = b'\x05123456\xfa7\x04abcde\x80junk'
>>> rldecode(s)
'1234567777777abcde'