def player(board):
    """
    Returns player who has the next turn on a board.
    """
    # raise NotImplementedError
    X_count = 0
    O_count = 0
    for i in board :
        for j in i :
            if j == 'X':
                X_count += 1 
            elif j == 'O':
                O_count += 1
    if X_count == O_count :
        return 'X'
    return 'O'