def fixed_len(s, length, append=None, no_linebreaks=False, align_right=False):
    """Returns the given string with a new length of len

    If the given string is too long, it is truncated and ellipsis are added.
    If it is too short, spaces are added. Linebreaks are removed.

    Args:
        s (str): The string to 
        length (int): The new length of the string
        append (str): The string to append
        no_linebreaks (bool): Whether line breaks should be filtered out

    Returns:
       The string with a fixed length plus the append string
    """

    if not s:
        return " " * length + append if append else ''

    if no_linebreaks:
        s = s.replace('\n', ' ').replace('\r', '')

    s = f"{s[:length-2]}.." if len(s) > length else \
        s.rjust(length, ' ') if align_right else s.ljust(length, ' ')

    return s + append if append else ''