def cut_apply(variable, value, cut_type):
    """Create a function to apply a cut on a variable within the events dataframe.

    Args:
        variable (str): variable name to cut on
        value (float): cut value
        type (str): type (greater or lower)

    Returns:
        function: function to apply the cut to the dataframe
    """

    def cut_func(event):
        if cut_type == "greater":
            return event[variable] >= value
        elif cut_type == "lower":
            return event[variable] <= value
        else:
            raise NotImplementedError

    return cut_func