def unpack(data, nbit):
if nbit > <NUM_LIT:8>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if <NUM_LIT:8> % nbit != <NUM_LIT:0>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if data.dtype not in (np.uint8, np.int8):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if nbit == <NUM_LIT:8>:<EOL><INDENT>return data<EOL><DEDENT>elif nbit == <NUM_LIT:4>:<EOL><INDENT>data = unpack_4to8(data)<EOL>return data<EOL><DEDENT>elif nbit == <NUM_LIT:2>:<EOL><INDENT>data = unpack_2to8(data)<EOL>return data<EOL><DEDENT>elif nbit == <NUM_LIT:1>:<EOL><INDENT>data = unpack_1to8(data)<EOL>return data<EOL><DEDENT>
upgrade data from nbits to 8bits

    Notes: Pretty sure this function is a little broken!