def read_file(filename: str, ignore_char: str = "#") -> list:
    """
    Read the file "filename" and stores it into a list of string where each element
    is a line of the file. For each lines, the characters after the "ignore_char" character (if present)
    are discarded. If the line is empty, i.e. a real empty line or a line that containted "ignore_char" as
    first character, then the line is discarded

    :param filename: str
        Path to the file to read.
    :param ignore_char: str
        Character delimiting comments and lines/part of lines to be discarded
    :return: list
        List of non-empty lines
    """

    file_str_list = []

    f = open(filename, "r")
    for i in f:
        file_str_list.append(i.strip("\n"))
    f.close()

    file_str_list_new = []

    for i in range(0, len(file_str_list)):
        index = file_str_list[i].find(ignore_char)
        if index != -1:
            file_str_list[i] = file_str_list[i][:index]
            file_str_list[i] = file_str_list[i].replace("\t", " ").strip(" ")

        if len(file_str_list[i]) > 0:
            file_str_list_new.append(file_str_list[i])

    return file_str_list_new