Convert a base k string into an integer.

def basek_string_to_base10_integer(k, x):
    """Convert a base k string into an integer."""
    assert 1 < k <= max_k_labeled
    return sum(numeral_index[c]*(k**i)
               for i, c in enumerate(reversed(x)))