import re


def remove_comments(text: str) -> str:
    """
    Removes comments from text. Comment lines are removed completely, including newline.

    :param text:    Input text
    :return:        Text without comments
    """
    return re.sub('(^[ \t]*#.*\n)|(#.*$)', '', text, flags=re.MULTILINE)