No this is wrong you shall not concatenate it into sentences but into text segments like {
        "start": 94.654,
        "end": 99.876,
        "text": "Tak se stalo, že jsem se v šesti letech vzdal skvělé malířské kariéry."
    },
    {
        "start": 101.697,
        "end": 109.34,
        "text": "Dospělí sami nikdy nic nechápou a děti hrozně unavuje stále a stále jim něco vysvětlovat."
    }, this shall not be the final length for "Tak se stalo, že jsem se v šesti letech vzdal skvělé malířské kariéry." Because the segment is too short and didn't reach the 11.6 limit I set as  concatenation limit, I shall add another words from "Dospělí sami nikdy nic nechápou a děti hrozně unavuje stále a stále jim něco vysvětlovat." And probably the complete sequence would be something like "Tak se stalo, že jsem se v šesti letech vzdal skvělé malířské kariéry. Dospělí sami nikdy nic nechápou a děti hrozně" this will reach the 11.6 and so the cycle will move to the next words "unavuje stále a stále jim něco vysvětlovat." Etc. make sure to fix the code #!/usr/bin/env python3

"""
Word Segment Merger

This script reads a JSON file containing word segments with start and end timestamps along with their corresponding text.
It merges word segments based on the specified concatenation limit (default: 2.0 seconds). Segments will be concatenated
one by one until they reach this limit.

The output is saved as a new JSON file with the same structure.

Usage:
    word_segment_merger.py <input_json_file> [-o <output_json_file>] [-c <concat_limit>] [-v]

Arguments:
    input_json_file      Path to the input JSON file containing word segments.

Options:
    -o, --output_json    Path to save the output JSON file (default: "merged_segments.json").
    -c, --concat_limit    Maximum duration (in seconds) for concatenated segments (default: 2.0).
    -v, --verbose         Enable verbose logging (default: False).
"""

import argparse
import json
import logging
from tqdm import tqdm

def setup_logging(verbose: bool) -> None:
    """Set up logging configuration.

    Args:
        verbose (bool): If True, set logging level to DEBUG; otherwise, INFO.
    """
    log_level = logging.DEBUG if verbose else logging.INFO
    logging.basicConfig(level=log_level, format='%(asctime)s - %(levelname)s - %(message)s')

def load_json(json_file: str) -> list:
    """Load and parse the JSON file containing word segments.

    Args:
        json_file (str): Path to the JSON file.

    Returns:
        list: List of dictionaries containing word segment information.

    Raises:
        json.JSONDecodeError: If the JSON file is improperly formatted.
        IOError: If there is an error reading the JSON file.
    """
    try:
        with open(json_file, 'r') as f:
            return json.load(f)
    except json.JSONDecodeError:
        logging.error(f"Error parsing JSON file: {json_file}")
        raise
    except IOError:
        logging.error(f"Error reading JSON file: {json_file}")
        raise

def format_duration(seconds: float) -> str:
    """Format duration from seconds to h:mm:ss.

    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 merge_segments(segments: list, concat_limit: float) -> tuple:
    """Merge word segments based on the concatenation limit.

    Args:
        segments (list): List of word segment dictionaries.
        concat_limit (float): Maximum duration for concatenated segments.

    Returns:
        tuple: A tuple containing merged segments and statistics on dropped segments.
    """
    merged_segments = []
    dropped_segments_count = 0
    dropped_duration = 0.0
    i = 0
    total_segments = len(segments)

    with tqdm(total=total_segments, desc="Processing segments", unit="segment") as pbar:
        while i < total_segments:
            current_segment = segments[i]
            current_duration = current_segment['end'] - current_segment['start']
            merged_text = current_segment['text']
            start_time = current_segment['start']

            # Start merging segments until we reach the concatenation limit
            while (i + 1 < total_segments and 
                   current_duration < concat_limit):
                next_segment = segments[i + 1]
                next_duration = next_segment['end'] - next_segment['start']

                # Check if adding the next segment exceeds the concatenation limit
                if current_duration + next_duration < concat_limit:
                    logging.debug(f"Merging with segment: {next_segment}")
                    merged_text += ' ' + next_segment['text']  # Concatenate text
                    current_duration += next_duration  # Update current duration
                    i += 1  # Move to the next segment
                else:
                    break  # Stop merging if the limit would be exceeded

            # Update the current segment's end time and append it to merged_segments
            merged_segments.append({
                'start': start_time,
                'end': start_time + current_duration,
                'text': merged_text.strip()
            })
            pbar.update(1)  # Update progress bar
            i += 1  # Move to the next segment

    return merged_segments, dropped_segments_count, dropped_duration

def save_json(json_file: str, data: list) -> None:
    """Save the merged word segments to a JSON file.

    Args:
        json_file (str): Path to the output JSON file.
        data (list): List of merged word segments.

    Raises:
        IOError: If there is an error writing to the JSON file.
    """
    try:
        with open(json_file, 'w') as f:
            json.dump(data, f, ensure_ascii=False, indent=4)
    except IOError:
        logging.error(f"Error writing to JSON file: {json_file}")
        raise

def main() -> int:
    """Main entry point of the script. Parses CLI arguments, loads the JSON file,
    merges the word segments, and saves the output.

    Returns:
        int: Exit code (0 for success, 1 for failure).
    """
    parser = argparse.ArgumentParser(description="Merge word segments based on specified rules.")
    parser.add_argument("input_json_file", help="Path to the input JSON file")
    parser.add_argument("-o", "--output_json", default="merged_segments.json",
                        help="Path to save the output JSON file (default: 'merged_segments.json').")
    parser.add_argument("-c", "--concat_limit", type=float, default=2.0,
                        help="Maximum duration (in seconds) for concatenated segments (default: 2.0).")
    parser.add_argument("-v", "--verbose", action="store_true", help="Enable verbose logging")

    args = parser.parse_args()
    setup_logging(args.verbose)

    logging.info("Starting segment merging process.")

    try:
        segments = load_json(args.input_json_file)
        logging.info(f"Loaded {len(segments)} segments from JSON file.")

        # Merge segments with specified concatenation limit
        merged_segments, dropped_count, dropped_duration = merge_segments(segments, args.concat_limit)

        save_json(args.output_json, merged_segments)
        logging.info(f"Successfully saved {len(merged_segments)} merged segments to {args.output_json}.")

        # Log dropped segment statistics
        total_duration = sum(seg['end'] - seg['start'] for seg in segments)
        dropped_percentage = (dropped_duration / total_duration * 100) if total_duration > 0 else 0

        if not args.verbose:
            logging.info(f"Dropped segments represent {dropped_percentage:.2f}% of total audio duration.")

    except Exception as e:
        logging.error(f"An error occurred: {str(e)}")
        return 1

    logging.info("Segment merging process completed.")
    return 0

if __name__ == "__main__":
    exit(main()) give me robust, quick python code with additional possibility to use it through cli args interface, code shall be very well and precise written, divided into small simple segments and functions, each segment's functionality shall be described with comments, make sure to use PEP8 formating, default values and description for cli interface shall be used whenever possible, apply high informational quality printing and logging stategies that will inform me about the processing, make sure I can set the debug mode with very detailed printing and logging, implement status progress information about execution of the code - tqdm and progress bars and information about total vs already processed items when applicable - this progress bar shall be stable, always visible and not distorted by print statements, prioritize showing of progress bar and unless I choose verbose mode inform me about statistics of the processing only at the end of the code after the execution is finished, add robust try and error statements and make sure that the is code quick and stable, include docstrings follow conventions outlined in the PEP 257 style guide, include detailed module-level docstring which serves as documentation for the entire script or module, give me detailed functions with  PEP 257 for docstrings and Google Style formating, make sure to give me module-level docstring, at the end of the script check the above requirements and make sure each of them is implemented in the code, 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,