def prefilter(data, filters):

    """
    Filter the data frame based on a set of fields and values.  
    Used to subset on specific event types and on specific users and repos for node-level measurements

    Inputs:
    data - DataFrame in 4-column format
    filters - A dictionary with keys indicating the field to filter, and values indicating the values of the field to keep

    Outputs:
    data - The filtered data frame

    """

    data.columns = ['time', 'event', 'user', 'repo']
    for field, values in filters.items():
        data = data[data[field].isin(values)]
    return data