keep all the functionality of the previous code the same, make sure the code will work in the same way, just update or correct the problematic parts,  Traceback (most recent call last):
  File "/mnt/5bf09f3e-bdd1-4c93-99bb-72c72bfda11b/AUDIO/Audio_Processing_Scripts/CSV_Dataset_Creator/huggingface_downloaded_datasets_into_csv_dataset.py", line 249, in <module>
    create_dataset(args.input_folder, args.output_csv, args.path_type,
  File "/mnt/5bf09f3e-bdd1-4c93-99bb-72c72bfda11b/AUDIO/Audio_Processing_Scripts/CSV_Dataset_Creator/huggingface_downloaded_datasets_into_csv_dataset.py", line 228, in create_dataset
    if result[1] == 'too short':
       ~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable import os
import csv
import argparse
import logging
import wave
import re
from multiprocessing import Pool, cpu_count

# Setup logging configuration
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)

def setup_parser() -> argparse.ArgumentParser:
    """
    Set up the argument parser for CLI input.

    Returns:
        argparse.ArgumentParser: The configured argument parser.
    """
    parser = argparse.ArgumentParser(
        description="Create a CSV dataset from audio and transcript files."
    )
    parser.add_argument('--input_folder', type=str, required=True, 
                        help="Path to the input folder containing audio and transcript files.")
    parser.add_argument('--output_csv', type=str, default='dataset.csv', 
                        help="Path to save the output dataset CSV file.")
    parser.add_argument('--path_type', type=str, choices=['absolute', 'relative'], default='relative',
                        help="Choose 'absolute' for full paths or 'relative' for paths relative to input_folder.")
    parser.add_argument('--min_wav_length', type=float, default=3.0, 
                        help="Minimum length of WAV files in seconds (default: 3.0).")
    parser.add_argument('--max_wav_length', type=float, default=11.6, 
                        help="Maximum length of WAV files in seconds (default: 11.6).")
    parser.add_argument('--min_text_length', type=int, default=20, 
                        help="Minimum character length for text (default: 20).")
    parser.add_argument('--max_text_length', type=int, default=200, 
                        help="Maximum character length for text (default: 200).")
    parser.add_argument('--drop_symbols', type=str, default='#*',
                        help="Symbols to drop from the text.")
    return parser

def normalize_text(text: str) -> str:
    """
    Normalize the text by removing extra spaces and replacing certain patterns.

    Args:
        text (str): The text to normalize.

    Returns:
        str: Normalized text.
    """
    # Normalize triple quotes to single quotes
    text = re.sub(r'""?"', '"', text)
    # Remove extra spaces
    return ' '.join(text.split())

def check_wav_length(file_path: str, min_length: float, max_length: float) -> (bool, str):
    """
    Check if the length of a WAV file is within the specified bounds.

    Args:
        file_path (str): Path to the WAV file.
        min_length (float): Minimum length in seconds.
        max_length (float): Maximum length in seconds.

    Returns:
        (bool, str): A tuple containing True/False for length validity and a reason.
    """
    try:
        with wave.open(file_path, 'rb') as wav_file:
            frame_rate = wav_file.getframerate()
            num_frames = wav_file.getnframes()
            duration = num_frames / frame_rate
            if duration < min_length:
                return False, 'too short'
            if duration > max_length:
                return False, 'too long'
            return True, ''
    except Exception as e:
        logger.error("Error checking WAV file length %s: %s", file_path, e)
        return False, 'error'

def should_drop_text(text: str, min_length: int, max_length: int, drop_symbols: str) -> bool:
    """
    Determine if a text should be dropped based on various criteria.

    Args:
        text (str): The text to check.
        min_length (int): Minimum acceptable length.
        max_length (int): Maximum acceptable length.
        drop_symbols (str): String of symbols that, if found, will cause the text to be dropped.

    Returns:
        bool: True if the text should be dropped, otherwise False.
    """
    if len(text) < min_length or len(text) > max_length:
        logger.debug("Text length out of bounds: %s (Length: %d)", text, len(text))
        return True
    if "{NICKNAME}" in text:
        logger.debug("Text contains '{NICKNAME}': %s", text)
        return True
    if re.search(r'<[^>]+>', text):  # Check for HTML tags
        logger.debug("Text contains HTML tags: %s", text)
        return True
    if any(symbol in text for symbol in drop_symbols):
        logger.debug("Text contains drop symbols (%s): %s", drop_symbols, text)
        return True
    return False

def process_file(audio_file: str, transcript_file: str, input_folder: str, 
                 min_wav_length: float, max_wav_length: float, 
                 min_text_length: int, max_text_length: int, 
                 drop_symbols: str, path_type: str) -> list:
    """
    Process a single audio and transcript file to extract data for the CSV.

    Args:
        audio_file (str): Name of the audio file.
        transcript_file (str): Name of the transcript file.
        input_folder (str): Path to the input folder.
        min_wav_length (float): Minimum allowed length of WAV files in seconds.
        max_wav_length (float): Maximum allowed length of WAV files in seconds.
        min_text_length (int): Minimum allowed character length for text.
        max_text_length (int): Maximum allowed character length for text.
        drop_symbols (str): Symbols that, if found, will cause the text to be dropped.
        path_type (str): 'absolute' or 'relative' path type for audio files.

    Returns:
        list: A list containing the output data or None if the entry should be dropped.
    """
    audio_path = os.path.join(input_folder, audio_file)
    transcript_path = os.path.join(input_folder, transcript_file)

    # Check WAV length
    valid_length, reason = check_wav_length(audio_path, min_wav_length, max_wav_length)
    if not valid_length:
        logger.warning("WAV file out of length bounds (%s): %s", reason, audio_file)
        return None

    # Read the transcript text
    try:
        with open(transcript_path, 'r', encoding='utf-8') as f:
            text = f.read().strip()
            if should_drop_text(text, min_text_length, max_text_length, drop_symbols):
                logger.warning("Text dropped due to filtering: %s", text)
                return None
            normalized_text = normalize_text(text)
    except Exception as e:
        logger.error("Error reading transcript file %s: %s", transcript_file, e)
        return None  # Skip this entry if there's an error

    # Use "EMPTY" as the speaker name
    speaker_name = "EMPTY"

    # Determine the output path based on path_type
    output_path = os.path.abspath(audio_path) if path_type == 'absolute' else os.path.join("audio", audio_file)

    return [output_path, normalized_text, speaker_name]

def format_duration(seconds: float) -> str:
    """
    Format duration in seconds to a string in hours:minutes:seconds.

    Args:
        seconds (float): Duration in seconds.

    Returns:
        str: Formatted duration as a string.
    """
    hours = int(seconds // 3600)
    minutes = int((seconds % 3600) // 60)
    seconds = int(seconds % 60)
    return f"{hours}:{minutes:02}:{seconds:02}"

def create_dataset(input_folder: str, output_csv: str, path_type: str, 
                   min_wav_length: float, max_wav_length: float, 
                   min_text_length: int, max_text_length: int, 
                   drop_symbols: str):
    """
    Create a CSV dataset from the audio and transcript files using multiprocessing.

    Args:
        input_folder (str): Path to the input folder.
        output_csv (str): Path to the output CSV file.
        path_type (str): 'absolute' or 'relative' path type for audio files.
        min_wav_length (float): Minimum allowed length of WAV files in seconds.
        max_wav_length (float): Maximum allowed length of WAV files in seconds.
        min_text_length (int): Minimum allowed character length for text.
        max_text_length (int): Maximum allowed character length for text.
        drop_symbols (str): Symbols that, if found, will cause the text to be dropped.
    """
    audio_files = {}
    transcript_files = {}
    total_audio_length = 0.0
    dropped_audio_length = 0.0
    dropped_due_to_shortness = 0
    dropped_due_to_longness = 0

    # Read audio and transcript files into dictionaries
    for filename in os.listdir(input_folder):
        if filename.endswith('.wav'):
            audio_id = filename.split('_')[0]
            audio_files[audio_id] = filename
        elif filename.endswith('.txt'):
            transcript_id = filename.split('_')[0]
            transcript_files[transcript_id] = filename

    logger.info("Found %d audio files and %d transcript files.", len(audio_files), len(transcript_files))

    # Prepare tasks for multiprocessing
    tasks = []
    for audio_id, audio_file in audio_files.items():
        if audio_id in transcript_files:
            transcript_file = transcript_files[audio_id]
            tasks.append((audio_file, transcript_file, input_folder, 
                           min_wav_length, max_wav_length, 
                           min_text_length, max_text_length, 
                           drop_symbols, path_type))

    # Process files in parallel
    with Pool(processes=cpu_count()) as pool:
        results = pool.starmap(process_file, tasks)

    # Filter out None results and write to CSV
    with open(output_csv, 'w', newline='', encoding='utf-8') as csvfile:
        writer = csv.writer(csvfile, delimiter='|')
        writer.writerow(['audio_file', 'text', 'speaker_name'])

        for result in results:
            if result is not None:
                writer.writerow(result)
                logger.info("Added entry: %s | %s | %s", result[0], result[1], result[2])
            else:
                # Increment counters for dropped audio length
                duration, reason = check_wav_length(os.path.join(input_folder, result[0]), min_wav_length, max_wav_length)
                if reason == 'too short':
                    dropped_due_to_shortness += 1
                elif reason == 'too long':
                    dropped_due_to_longness += 1

    # Log summary
    logger.info("Summary of processing:")
    logger.info("Dropped due to shortness: %d", dropped_due_to_shortness)
    logger.info("Dropped due to longness: %d", dropped_due_to_longness)

    # Calculate total lengths
    total_audio_length = sum(
        check_wav_length(os.path.join(input_folder, file), min_wav_length, max_wav_length)[0] for file in audio_files.values()
    )
    dropped_audio_length = dropped_due_to_shortness * min_wav_length + dropped_due_to_longness * max_wav_length
    total_duration_seconds = sum(check_wav_length(os.path.join(input_folder, file), min_wav_length, max_wav_length)[0] for file in results if result)
    
    logger.info("Total audio length processed: %s", format_duration(total_duration_seconds))
    logger.info("Dropped audio length: %s", format_duration(dropped_audio_length))
    logger.info("Length of audio used in the dataset: %s", format_duration(total_audio_length))

def main():
    """
    Main function to execute the CSV dataset creation process.
    """
    parser = setup_parser()
    args = parser.parse_args()

    try:
        # Create the dataset
        create_dataset(
            args.input_folder, args.output_csv, args.path_type,
            args.min_wav_length, args.max_wav_length,
            args.min_text_length, args.max_text_length,
            args.drop_symbols
        )
        logger.info("Dataset created successfully: %s", args.output_csv)
    except Exception as e:
        logger.error("An error occurred during dataset creation: %s", e)

if __name__ == '__main__':
    main() when dropping wav file because of length print me also whether it's because it's too long or too short, print me at the end of the script how many files were 1. dropped due to shortness, 2. Dropped because they were too long, 3. You shall give me the total length of dataset in hours:minutes:seconds, dropped audio length in hours:minutes:seconds and also give me length of audio that was successfully processed and added into csv dataset in hours:minutes:seconds, you shall count the percentage how much of the total audio was used in the dataset, give me python script with cli args interface very well written, with comments, documented functions with docstrings, with pep8 formating, default values and description for cli interface, apply high informational quality printing and logging stategies that will inform me about the processing, progress and running of the code, add robust try and error statements and make the code quick and stable, keep all the functionality of the previous code the same, make sure the code will work in the same way, just update or correct the problematic parts,