from typing import Counter


def validate(lyst, pred):
    """
    Validates if the prediction should be written to the file
    
    This function counts the outputs stored in the list, if the
    most predicted output occurs more than 30 times, it returns True,
    otherwise returns False

    Parameters
    ----------
    lyst: list
        a list that contants recently predicted outputs
    pred: char
        the last predicted character
    
    Returns
    -------
    boolean
        True if the output should be stored to files, otherwise False
    """

    if Counter(lyst)[pred] > 30:
        return True
    return False