def METHOD_NAME(self, text):
    """
    Applies text normalization rules.
    Args:
        text: input text
    Returns:
        clean text
    """
    # Trim whitespace
    text = text.strip()
    # Convert all upper case strings to capitalized case
    return text.capitalize() if text.isupper() else text