Determine the number of bits to pack/unpack.

def _get_bits(bits=None, target=None):
    """
    Determine the number of bits to pack/unpack.
    """

    if bits is not None:
        bits = int(bits)
        if bits in (8, 16, 32, 64):
            return bits
        else:
            raise ValueError('bits needs to be 8, 16, 32 or 64')
    else:
        return int((target if target is not None else pwnypack.target.target).bits)