def compare_bits(mem_entry, mem_idx, test_bit):
    """Compare a memory entry to the expected bit value for that entry"""
    valid_entry = True
    for bit_idx, bit in enumerate(reversed(mem_entry)):
        valid_entry = False
        assert int(bit) == test_bit, (
            "Incorrect bit @ index {} of mem entry #{:04} ".format(bit_idx, mem_idx) +
            "from the LSB (bit 0)\n"
            "Expected value: {}, Actual value: {}".format(test_bit, bit))
    return valid_entry