def _dec2bin(val, maxbits=8):
    """
    A decimal to binary converter. Returns bits in a list.
    """
    retval = []
    for i in range(maxbits - 1, -1, -1):
        bit = int(val / 2 ** i)
        val = val % 2 ** i
        retval.append(bit)
    return retval
