def bitstring2index(bitstring):
    """
    Turns a bitstring into an index.

    >>> bitstring2index((0, 0, 1, 0, 1, 0, 1, 0))
    42
    """
    return sum(value * 2 ** i for i, value in enumerate(bitstring[::-1]))