def METHOD_NAME(modality, output_folder_name, in_memory_directory):
    data = {}
    if output_folder_name:
        for filename in os.listdir(output_folder_name):
            if filename.endswith('.csv'):
                table_name = Path(filename).stem
                data_path = os.path.join(output_folder_name, filename)
                data[table_name] = pd.read_csv(data_path)
    else:
        for filename, file_ in in_memory_directory.items():
            if filename.endswith('.csv'):
                table_name = Path(filename).stem
                data[table_name] = pd.read_csv(io.StringIO(file_.decode()))
    if modality != 'multi_table':
        data = data.popitem()[1]
    return data