def split_long_str(string, sep=" ", long_str_threshold=-1, sep_replacement_before="", sep_replacement_after=""):
    """
    Split a long string into an array of parts.

    The string will be split at occurrences of the given separator in a way that makes sure that each part is
    shorter than the given threshold length.

    :param str string: String we want to split.
    :param str sep: The delimiter according which to split the string.
    :param int long_str_threshold: Don't split at a delimiter if the resulting parts will be shorter than this
        threshold. The default value -1 indicates that we should always split at a delimiter.
    :param str sep_replacement_before: When splitting at a separator, the separator will be replaced with this string
        in the part before the split.
    :param str sep_replacement_after: When splitting at a separator, the separator will be replaced with this string
        in the part after the split.
    :return: Parts of the original string after the split.
    :rtype: List[str]

    .. rubric Examples

    >>> split_long_str("Hello world", long_str_threshold=1)
    ['Hello', 'world']
    >>> split_long_str("Hello world", long_str_threshold=15)
    ['Hello world']
    >>> split_long_str("My quite long sentence example", long_str_threshold=15)
    ['My quite long', 'sentence', 'example']
    >>> split_long_str("Hello world", sep_replacement_before="_")
    ['Hello_', 'world']
    >>> split_long_str("Hello world", sep_replacement_after="_")
    ['Hello', '_world']
    """
    potential_parts = string.split(sep)
    if long_str_threshold == -1:
        if sep_replacement_before != "":
            for i in range(0, len(potential_parts) - 1):
                potential_parts[i] += sep_replacement_before
        if sep_replacement_after != "":
            for i in range(1, len(potential_parts)):
                potential_parts[i] = sep_replacement_after + potential_parts[i]
        return potential_parts
    parts = []
    part = potential_parts[0]
    for i in range(1, len(potential_parts)):
        if len(part + sep + potential_parts[i] + sep_replacement_before) < long_str_threshold:
            part += sep + potential_parts[i]
        else:
            parts.append(part + sep_replacement_before)
            part = sep_replacement_after + potential_parts[i]
    parts.append(part)
    return parts