def remove_crlf()

in src/sagemaker_inference/utils.py [0:0]


def remove_crlf(illegal_string):
    """Removes characters prohibited by the MMS dependency Netty.

    https://github.com/netty/netty/issues/8312

    Args:
        illegal_string: The string containing prohibited characters.

    Returns:
        str: The input string with the prohibited characters removed.
    """
    prohibited = ("\r", "\n")

    sanitized_string = illegal_string

    for character in prohibited:
        sanitized_string = sanitized_string.replace(character, " ")

    return sanitized_string