def state_value(state, address, init=0, end=15):
    """
    init and end are included on the desired slice
    """
    if state is None:
        return 0
    binary = format(state[address], '016b')
    r_init = len(binary)-1-init
    r_end = len(binary)-1-end
    kBitSubStr = binary[r_end: r_init+1]
    return int(kBitSubStr, 2)