def bit_string_index(text):
n = len(text)<EOL>k = text.count("<STR_LIT:1>")<EOL>if text.count("<STR_LIT:0>") != n - k:<EOL><INDENT>raise VisualizationError("<STR_LIT>")<EOL><DEDENT>ones = [pos for pos, char in enumerate(text) if char == "<STR_LIT:1>"]<EOL>return lex_index(n, k, ones)<EOL>
Return the index of a string of 0s and 1s.