def sub_when_empty(string: str, empty_str: str = "-") -> str:
    """
    Just returns a given string if it is not empty. If it is empty though, a default
    string is returned instead.

    Parameters
    ----------
    string
        The string to check if it is empty or not
    empty_str
        The string to be returned if the given string is empty

    Returns
    -------
    result_string
        Either the given string (when 'string' is not empty) or the empty_str (when
        'string' is empty)
    """
    if type(string) is not str:
        raise TypeError(f"Input must be of type string. Found: type '{type(string)}'")
    if len(string) > 0:
        result_string = string
    else:
        result_string = empty_str
    return result_string