def _line_to_list(line):
    """Converts a pla line to a list of ints.
    
    Raises a ValueError if it encounters an unexpected character."""
    l = []
    for c in line:
        if c == '0':
            l.append(0)
        elif c == '1':
            l.append(1)
        elif c == '-' or c == '~':
            l.append(2)
        else:
            raise ValueError
    return l