def ascii85decode(data):
n = b = <NUM_LIT:0><EOL>out = b'<STR_LIT>'<EOL>for c in data:<EOL><INDENT>if b'<STR_LIT:!>' <= c and c <= b'<STR_LIT:u>':<EOL><INDENT>n += <NUM_LIT:1><EOL>b = b*<NUM_LIT>+(ord(c)-<NUM_LIT>)<EOL>if n == <NUM_LIT:5>:<EOL><INDENT>out += struct.pack('<STR_LIT>', b)<EOL>n = b = <NUM_LIT:0><EOL><DEDENT><DEDENT>elif c == b'<STR_LIT:z>':<EOL><INDENT>assert n == <NUM_LIT:0><EOL>out += b'<STR_LIT>'<EOL><DEDENT>elif c == b'<STR_LIT>':<EOL><INDENT>if n:<EOL><INDENT>for _ in range(<NUM_LIT:5>-n):<EOL><INDENT>b = b*<NUM_LIT>+<NUM_LIT><EOL><DEDENT>out += struct.pack('<STR_LIT>', b)[:n-<NUM_LIT:1>]<EOL><DEDENT>break<EOL><DEDENT><DEDENT>return out<EOL>
In ASCII85 encoding, every four bytes are encoded with five ASCII
letters, using 85 different types of characters (as 256**4 < 85**5).
When the length of the original bytes is not a multiple of 4, a special
rule is used for round up.

The Adobe's ASCII85 implementation is slightly different from
its original in handling the last characters.

The sample string is taken from:
  http://en.wikipedia.org/w/index.php?title=Ascii85

>>> ascii85decode(b'9jqo^BlbD-BleB1DJ+*+F(f,q')
'Man is distinguished'
>>> ascii85decode(b'E,9)oF*2M7/c~>')
'pleasure.'