import re


def clean_utterance_text(text: str) -> str:
    """Removes line breaking and extra spaces in the user utterance."""
    # sometimes the user utterance contains line breaking and extra spaces
    text = re.sub(r"\s+", " ", text)
    # sometimes the user utterance has leading/ending spaces
    text = text.strip()
    return text