def get_char_index(alphabet, char):
    """This is the same as alphabet.index(char), but with more helpful errors."""
    try:
        return alphabet.index(char)
    except ValueError:
        raise ValueError('Could not find {} in alphabet {}.'.format(repr(
            char), repr(alphabet)))
