def unpack(endian, fmt, data):
if fmt == '<STR_LIT:s>':<EOL><INDENT>val = struct.unpack('<STR_LIT>'.join([endian, str(len(data)), '<STR_LIT:s>']),<EOL>data)[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>num = len(data) // struct.calcsize(fmt)<EOL>val = struct.unpack('<STR_LIT>'.join([endian, str(num), fmt]), data)<EOL>if len(val) == <NUM_LIT:1>:<EOL><INDENT>val = val[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>return val<EOL>
Unpack a byte string to the given format. If the byte string
    contains more bytes than required for the given format, the function
    returns a tuple of values.