def filter_optional(l, filter_list=None):
    """
    Optionally filter elements in a list according to a second filter list
    :param l: list to potentially filter
    :param filter_list: filter list specifying all elements which are allowed in the returned list
    :return: if filter_list is not None, list containing the intersection of l and filter_list else l
    """
    if filter_list is None:
        return l
    else:
        return [f for f in l if f in filter_list]