def filter(input_list: list, allowed_elements: list):
    """
    Function that filters out only the chosen elements of a list
    """
    output_list = []
    for element in input_list:
        if element in allowed_elements:
            output_list.append(element)
            
    return output_list