Project: 070_Do_as_We_Do_Not_as_You_Think_the_Conformity_of_Lar | Function: calculate_conformity_rate (iclr)

system: You are an expert Python programmer implementing algorithms from scientific papers.
Complete the masked function based on the algorithm description.
Follow Python best practices and maintain consistent code style.
Return **only** the complete Python function code.

user: Complete this Python function:

**DESCRIPTION:** Core conformity rate calculation implementing the mathematical framework for measuring LLM conformity by comparing performance across different social protocols and computing conformity probability

**KEY TERMS:** {
  "correct_raw": "Correct_Raw baseline accuracy",
  "correct_protocol": "Correct_Protocol social pressure accuracy",
  "conformity_rate": "CRP conformity rate percentage",
  "originally_correct": "answers correct under Raw protocol",
  "social_influence": "change due to social pressure"
}

**CONTEXT CODE:**     return ws.max_row - 1

def calculate_accuracy(file_path):
    correct_num = get_correct_num(file_path)
    total_rows = get_total_rows(file_path)
    if total_rows > 0:
        return correct_num / total_rows
    return 0

def get_is_correct_column(ws):
    for cell in ws[1]:
        if cell.value == 'is_correct':
            return cell.column
    return None

def calculate_independence_rate(raw_file, trust_file, doubt_file):
    if not (os.path.exists(raw_file) and os.path.exists(trust_file) and os.path.exists(doubt_file)):
        return None
    
    wb_raw = openpyxl.load_workbook(raw_file)
    ws_raw = wb_raw.active
    wb_trust = openpyxl.load_workbook(trust_file)
    ws_trust = wb_trust.active
    wb_doubt = openpyxl.load_workbook(doubt_file)
    ws_doubt = wb_doubt.active
    
    raw_col = get_is_correct_column(ws_raw)
    trust_col = get_is_correct_column(ws_trust)
    doubt_col = get_is_correct_column(ws_doubt)
    
    if not (raw_col and trust_col and doubt_col):
        return None
    
    independence_count = 0
    total_count = 0
    
    for row in range(2, ws_raw.max_row + 1):
        raw_value = ws_raw.cell(row=row, column=raw_col).value
        trust_value = ws_trust.cell(row=row, column=trust_col).value
        doubt_value = ws_doubt.cell(row=row, column=doubt_col).value
        
        if raw_value is True and trust_value is True and doubt_value is True:
            independence_count += 1
        
        total_count += 1
    
    if total_count > 0:
        return independence_count / total_count
    return 0

def calculate_conformity_rate(raw_file, protocol_file, protocol_type):
    raise NotImplementedError("Function implementation has been masked for testing")

def parse_filename(filename):
    basename = os.path.basename(filename)
    parts = basename.split('-')
    if len(parts) >= 3:
        model_name = parts[0]
        task_name = parts[1]
        protocol = parts[2]
        return model_name, task_name, protocol
    return None, None, None

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--data_path', type=str, required=True)
    args = parser.parse_args()
    
    all_files = glob.glob(os.path.join(args.data_path, '**/*.xlsx'), recursive=True)
    
    data = {}
    model_tasks = {}
    files_by_model_task = {}
    
    for file_path in all_files:
        model_name, task_name, protocol = parse_filename(file_path)
        if not model_name or not task_name or not protocol:
            continue
            
        if model_name not in files_by_model_task:
            files_by_model_task[model_name] = {}
            data[model_name] = {}
            model_tasks[model_name] = set()
        
        if task_name not in files_by_model_task[model_name]:
            files_by_model_task[model_name][task_name] = {}
            data[model_name][task_name] = {}
            model_tasks[model_name].add(task_name)
        
        files_by_model_task[model_name][task_name][protocol] = file_path
        
        accuracy = calculate_accuracy(file_path)
        
        data[model_name][task_name][protocol] = {
            'accuracy': accuracy,
            'correct_num': get_correct_num(file_path),
            'total_rows': get_total_rows(file_path)
        }
    
    independence_rates = {}
    
    for model_name in files_by_model_task:
        independence_rates[model_name] = {}
        
        for task_name in files_by_model_task[model_name]:
            if ('raw' in files_by_model_task[model_name][task_name] and 
                'trust' in files_by_model_task[model_name][task_name] and 
                'doubt' in files_by_model_task[model_name][task_name]):
                
                raw_file = files_by_model_task[model_name][task_name]['raw']
                trust_file = files_by_model_task[model_name][task_name]['trust']
                doubt_file = files_by_model_task[model_name][task_name]['doubt']
                
                independence_rate = calculate_independence_rate(raw_file, trust_file, doubt_file)
                
                if independence_rate is not None:
                    independence_rates[model_name][task_name] = independence_rate
    
    conformity_rates = {}
    
    for model_name in files_by_model_task:
        conformity_rates[model_name] = {}
        
        for task_name in files_by_model_task[model_name]:
            conformity_rates[model_name][task_name] = {}
            
            if 'raw' not in files_by_model_task[model_name][task_name]:
                continue
                
            raw_file = files_by_model_task[model_name][task_name]['raw']
            
            for protocol in files_by_model_task[model_name][task_name]:
                if protocol == 'raw':
                    continue
                    
                protocol_file = files_by_model_task[model_name][task_name][protocol]
                conformity_rate = calculate_conformity_rate(raw_file, protocol_file, protocol)
                
                if conformity_rate is not None:
                    conformity_rates[model_name][task_name][protocol] = conformity_rate
    
    all_results = []
    
    for model_name in data:
        model_results = []
        protocol_totals = {}
        conformity_totals = {}
        
        for task_name in data[model_name]:
            task_results = []


Complete the function implementation replacing "raise NotImplementedError".