def restore_bytes(nb):
for ws in nb.worksheets:<EOL><INDENT>for cell in ws.cells:<EOL><INDENT>if cell.cell_type == '<STR_LIT:code>':<EOL><INDENT>for output in cell.outputs:<EOL><INDENT>if '<STR_LIT>' in output:<EOL><INDENT>output.png = str_to_bytes(output.png, '<STR_LIT:ascii>')<EOL><DEDENT>if '<STR_LIT>' in output:<EOL><INDENT>output.jpeg = str_to_bytes(output.jpeg, '<STR_LIT:ascii>')<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>return nb<EOL>
Restore bytes of image data from unicode-only formats.

    Base64 encoding is handled elsewhere.  Bytes objects in the notebook are
    always b64-encoded. We DO NOT encode/decode around file formats.