def check_make_string_valid(text: str, coerce: bool = True) -> str:
    """ does some simple validation and coercsion for empty strings

    Args:
        text (str): text of type str
        coerce (bool, optional): if an empty or None string is passed, return an empty string?. Defaults to True.

    Raises:
        TypeError: _description_

    Returns:
        _type_: something that is a string
    """
    empty_string = " "

    if text in [[], None, '', "", empty_string] and coerce:
        return empty_string

    if text.isspace():
        return empty_string

    if not isinstance(text, str):
        raise TypeError(f"text had type {type(text)} but expected str")

    return text
 does some simple validation and coercsion for empty strings

    Args:
        text (str): text of type str
        coerce (bool, optional): if an empty or None string is passed, return an empty string?. Defaults to True.

    Raises:
        TypeError: _description_

    Returns:
        _type_: something that is a string
    
src/marqo/inference/media_download_and_preprocess/split_text.py