def decode(symbol_list, bit_count):
    """ Decodes the value encoded on the end of a list of symbols.
        Each symbol is a bit in the binary representation of the value, with more significant
        bits at the end of the list.

        - `symbol_list` - the list of symbols to decode from.
        - `bit_count` - the number of bits from the end of the symbol list to decode.
    """
    assert bit_count > 0, "The given number of bits (%d) is invalid." % bit_count
    assert bit_count <= len(symbol_list), "The given number of bits (%d) is greater than the length of the symbol list. (%d)" % (bit_count, len(symbol_list))

    # Take the last `bit_count` number of symbols from the end of the given symbol list.
    bits = symbol_list[-bit_count:]

    # Reverse the list of bits, and make a string out of them.
    bits.reverse()
    bit_string = ''.join(map(str, bits))

    # Return the bit string as an integer via the built-in int command, telling it that the number in the string is binary/base 2.
    return int(bit_string, 2)