def str_to_grid(sudoku, fill_possibilities=False):
    """
    Convert an 81-char string sequence representing sudoku into a grid (dict)
    with keys as indexes [0-80] and values as possible assignments. Valid
    values are [1-9] for filled cells. All other characters represent an empty
    cell.
    """
    if len(sudoku) != 81:
        return None

    possibilities = set(range(1, 10)) if fill_possibilities else set()

    return {ndx: {int(s)} if s in '123456789' else possibilities
            for ndx, s in enumerate(sudoku)}