import re


def clean_kql_query(query_string: str) -> str:
    """
    Return kql query stripped of comments and newline characters.

    Parameters
    ----------
    query_string : str
        Input query

    Returns
    -------
    str
        Cleaned query.

    """
    remove_comments = re.sub(r"(//[^\"\'\n]+)", " ", query_string, re.MULTILINE).strip()
    # get rid of newlines and returns
    return re.sub(r"(\s*\n\s*)", " ", remove_comments)