def filter_sframe_by_func(sf, filter_func):
    """
    Filter Sframe using a filter function
    :param sf: SFrame object
    :param filter_func: a function that return 1 for the lines we want to keep and 0 for the lines we want to filter out
    :return: filtered SFrame
    :rtype: gl.SFrame
    """
    if filter_func is None:
        return sf

    return sf[sf.apply(lambda r: filter_func(r))]