def custom_rstrip(s: str) ->str:
    """
    A custom rstrip that only strips the last Enter if it exists,
    keeping the other whitespace characters. This allows outputing
    values with whitespace formatting at the end, while handling
    the most common case of a single echo with an enter.

    """
    if s and s[-1] == '\n':
        s = s[0:-1]
    return s
