Project: s41467-024-46945-x | Function: convert_characters (python)

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:** Standardizes character encoding and special symbols in clinical trial text data for consistent processing and analysis of international trial database content

**KEY TERMS:** {
  "text_input": "raw clinical trial text from Trialtrove database",
  "conversion_table": "mapping dictionary for character standardization",
  "normalized_text": "processed text with standardized encoding",
  "special_chars": "Unicode symbols requiring conversion",
  "clean_output": "standardized text ready for analysis"
}

**CONTEXT CODE:** #Functions to replace characters that have unicode numbers higher than 127 and hence are not in the ASCII set and
#convert an Excel input file into an ASCII text output file
#Code written by Ashwin Kammula; 
#Usage python -c 'import trialtrove_processing_wcomments; trialtrove_processing_wcomments.process("input.xlsx","output.txt")
import pandas as pd
import numpy as np
import sys
#character_conversion.py is a dictionary mapping special characters to their replacement strings
from character_conversion_table import character_mapping 

#replace characters in string_list
def replace(string_list,src,dest):
    return [x.replace(src,dest) if not pd.isnull(x) else np.nan for x in string_list]

def string_to_print(src):
    return "newline" if src == "\n" else "tab" if src == "\t" else ","

def convert_characters(inputFile, outputFile):
    # MASKED: Standardizes character encoding and special symbols in clinical trial text data for consistent processing and analysis of international trial database content
    raise NotImplementedError("This function is masked for testing purposes.")

#input_file is the input, which should be an Excel file; output_file is the output in which string are replaced  
def process(input_file, output_file):
    trial_trove_xl = pd.read_excel(input_file)
    # Copy it so no changes are done on the original file
    trial_trove_xl_corrected = trial_trove_xl.copy(deep=True)
    #replace white space that are not plain spaces within a cell
    # Define strings from:to mapping 
    replace_dic = {"\n":" ","\t":" "}

    # We only interested in columns of type "object" (= strings)
    for attribute in trial_trove_xl_corrected.columns[list(trial_trove_xl_corrected.dtypes == "object")]:
        for src,dest in replace_dic.items():
            trial_trove_xl_corrected[attribute] = replace(trial_trove_xl_corrected[attribute],src,dest)

    # Check that no "invalid characters" remain
    flag = True
    for src in replace_dic.keys():
        for attribute in trial_trove_xl_corrected.columns[list(trial_trove_xl_corrected.dtypes == "object")]:
            if any(trial_trove_xl_corrected[attribute].dropna().str.contains(src)):
                print(f"Attribute: \"{attribute}\" still contains {string_to_print(src)}")
                flag = False

    # If all is well, write corrected DataFrame to csv
    if flag:
        print("All invalid characters were replaced successfully")
        trial_trove_xl_corrected.to_csv(output_file, sep ='\t', index=False)
        convert_characters(output_file, output_file)
    else:
        print("Something is wrong. Check previous input for attributes still containing invalid characters")


Complete the function implementation replacing "raise NotImplementedError".