import re


def clean_librispeech(txt):
    """
    Lowercases the input string and removes anything but characters a-z and whitespaces.

    Also normalizes whitespace characters and strip trailing ones.

    The final character set will be:
        - letters: "a-z"
        - apostrophe: "'"
        - whitespace: " "

    Args:
        txt: Text to be normalized.

    Returns:
        str: The normalized string.
    """

    # lowercase and strip trailing whitespaces
    txt = txt.lower().strip()

    # whitespace normalization: convert whitespace sequences to a single whitespace
    txt = re.sub(r'\s+', ' ', txt)

    return txt